package cn.fl.product.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCdMapDQueryCondition;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.api.IUploadApiService;
import cmm.comm.facade.upload.condition.SysUlDatCfgQueryCondition;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.dto.SysUlDatCfgDTO;
import cmm.comm.facade.upload.dto.SysUlDatCfgDtlDTO;
import cmm.comm.facade.upload.dto.SysUlFilesRecDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.constant.SysOrgConstant;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.atc.service.IAtcBscInfoService;
import cn.fl.atc.vo.AtcBscInfoVO;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.vo.CstValidCardInfoVO;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.hsj.service.IHsjQueryService;
import cn.fl.npspl.service.ISplNpBscInfoService;
import cn.fl.npspl.service.ISplNpSocialRlService;
import cn.fl.product.service.IPrdBscInfoService;
import cn.fl.product.service.ISplBscInfoApplyService;
import cn.fl.product.service.ISplInfoService;
import cn.fl.product.service.ISplRlPsnService;
import cn.fl.product.vo.SplFlowSHVO;
import cn.fl.product.vo.SplInfoVO;
import cn.fl.product.vo.SplRlPsnVO;
import cn.fl.project.constant.PrjLnkCompConstant;
import cn.fl.project.vo.PrjFileInfoVO;
import cn.fl.project.vo.PrjLnkCompRlPsnVO;
import cn.fl.spl.service.ISplOpLogRecService;
import cn.fl.spl.vo.SplLimRateVO;
import cn.fl.splrate.service.ISplRateRelInfoService;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysDictionaryService;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.vo.SysCdMapDVO;
import cn.fl.system.vo.SysUlFilesRecVO;
import cn.fl.upload.constant.UploadConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.constant.facade.framework.constant.SystemConstant;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.flow.facade.flow.api.IFlowApiService;
import fl.flow.facade.flow.condition.SysFlowSHQueryCondition;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.FlowStartParamsDTO;
import fl.flow.facade.flow.dto.SysFlowSHDTO;
import fl.riskctrl.facade.riskctrl.riskctrlsingle.api.IRiskCtrlSingleApiService;
import fl.spl.facade.atc.condition.AtcBscInfoQueryCondition;
import fl.spl.facade.atc.constant.AtcBscInfoConstant;
import fl.spl.facade.framework.constant.SplSystemConstant;
import fl.spl.facade.framework.enums.*;
import fl.spl.facade.spl.api.ISplExtInfoApiService;
import fl.spl.facade.spl.api.ISplInfoQueryApiService;
import fl.spl.facade.spl.api.ISplRenewProtocolRecApiService;
import fl.spl.facade.spl.condition.SplInfoQueryCondition;
import fl.spl.facade.spl.condition.SplRenewProtocolRecQC;
import fl.spl.facade.spl.constant.SplInfoConstant;
import fl.spl.facade.spl.dto.SplExtInfoDTO;
import fl.spl.facade.spl.dto.SplInfoDTO;
import fl.spl.facade.spl.dto.SplRenewProtocolRecDTO;
import fl.spl.facade.spllim.condition.SplLimRateQC;
import fl.spl.facade.splrate.api.ISplRateRelInfoApiService;
import fl.spl.facade.splrate.api.ISplRateRelInfoQueryApiService;
import fl.spl.facade.splrate.condition.SplRateRelInfoQC;
import fl.spl.facade.splrate.constant.SplRateRelInfoConstant;
import fl.spl.facade.splrate.dto.SplRateRelInfoDTO;
import fl.spl.facade.store.api.ISplPropInfoApiService;
import fl.spl.facade.store.condition.SplPropInfoQueryCondition;
import fl.spl.facade.store.dto.SplPropInfoDTO;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import sp.dealer.facade.dealer.condition.SplCommBasicQC;
import tc.relationmap.facade.relationmap.hsj.dto.HsjBasicDTO;
import tc.relationmap.facade.relationmap.hsj.dto.HsjPersonDTO;
import tc.relationmap.facade.relationmap.hsj.dto.HsjShareHolderDTO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.Map.Entry;

/**
 * @Description: 供应商信息表 控制层
 */
@Controller
@RequestMapping("/product/splInfo")
public class SplInfoController extends BaseController {

	/**
	 * PrdSplInfo 服务层BEAN
	 */
	@Autowired
	private ISplInfoService prdSplInfoService;

	/**
	 * 本地数据字典服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	@Autowired
	private IPrdBscInfoService prdBscInfoService;

	@Autowired
	private ISplRlPsnService splRlPsnService;

	@Autowired
	private IFlowApiService flowApiService ;

	@Autowired
	private ICstBscInfoService cstBscInfoService;

	@Autowired
	private IAtcBscInfoService atcBscInfoService;

	@Autowired
	private ISplBscInfoApplyService splBscInfoApplyService;

	@Autowired
	private ISplRenewProtocolRecApiService splRenewProtocolRecApiService;

	@Autowired
	private ISplOpLogRecService splOpLogRecService;
	@Autowired
	private ISplNpSocialRlService splNpSocialRlService;

	@Autowired
	private ISplNpBscInfoService splNpBscInfoService;

	@Autowired
	private IRiskCtrlSingleApiService riskCtrlSingleApiService;

	@Autowired
	private ISysUlFilesRecService sysUlFilesRecService ;

	@Autowired
	private IUploadApiService uploadApiService ;
	@Autowired
	private ISplExtInfoApiService splExtInfoApiService;

	//好数聚查询供应商基础信息
	@Autowired
	private IHsjQueryService hsjQueryService ;

	@Autowired
	private ISysDictionaryService sysDictionaryService;

	@Autowired
	private ISplRateRelInfoQueryApiService splRateRelInfoQueryApiService;

	@Autowired
	private ISplInfoQueryApiService splInfoQueryApiService ;

	@Autowired
	private ISplPropInfoApiService splPropInfoApiService ;
	/**
	 * 跳转到供应商项目详细页面
	 */
	@RequestMapping(value = "/toSplPrjBscInfoDetailList.do", method = { RequestMethod.GET})
	public ModelAndView toCstProjectDetailPage(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");
		ModelAndView view = new ModelAndView("product/splInfo/splPrjBscInfoDetailList");
		view.addObject("splPrjViewFlag","splPrjViewFlag");
		view.addObject("splId", splId);
		return view;
	}
	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		String mfrId = request.getParameter("mfrId");

		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoList");
		view.addObject("mfrId", mfrId);

		//获取下拉列表数据
		//审核状态
		List<KeyValueVO> searchAudStsCdList = this.prdSplInfoService.searchAudStsCdList();
		view.addObject("searchAudStsCdList", searchAudStsCdList);
		//事业部
		List<KeyValueVO> searchBuOrgList = this.prdSplInfoService.searchBuOrgCdList();
		view.addObject("searchBuOrgList", searchBuOrgList);
		//供应商属性
		List<KeyValueVO> splAttrCdList = this.prdSplInfoService.searchSplAttrCdList();
		view.addObject("splAttrCdList", splAttrCdList);
		view.addObject("currOrgCd", CurrentThreadContext.getCurrentOrgCd());
		view.addObject("currBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		//供应商类型 jiangzg add 2017-8-8 14:24:02
		List<KeyValueVO> kvList = null ;
		List<SysDictionaryDTO> sysDictionaryDTOList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.SPL_TYP_GRP_CD);
		if (CollectionUtils.isNotEmpty(sysDictionaryDTOList)) {
			kvList = new ArrayList<>(sysDictionaryDTOList.size());
			for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOList) {
				KeyValueVO keyValueVO = new KeyValueVO();
				keyValueVO.setKey(sysDictionaryDTO.getCode());
				keyValueVO.setValue(sysDictionaryDTO.getCodeNm());
				kvList.add(keyValueVO);
			}
		}
		view.addObject("searchSplTypCdList", kvList);
		List<SysDictionaryDTO> dictionaryDTOS = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_SYS_YES_NO_CD);
		if (CollectionUtils.isNotEmpty(dictionaryDTOS)) {
			kvList = new ArrayList<>(dictionaryDTOS.size());
			for (SysDictionaryDTO sysDictionaryDTO : dictionaryDTOS) {
				KeyValueVO keyValueVO = new KeyValueVO();
				keyValueVO.setKey(sysDictionaryDTO.getCode());
				keyValueVO.setValue(sysDictionaryDTO.getCodeNm());
				kvList.add(keyValueVO);
			}
		}
		view.addObject("isOrNotBlackList", kvList);
		return view;
	}
	/**
	 * 到列表详情页面
	 */
	@RequestMapping(value = "/toDetailListPage.do", method = { RequestMethod.GET})
	public ModelAndView toDetailListPage(HttpServletRequest request, HttpServletResponse response) {
		String mfrId = request.getParameter("mfrId");

		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoDetailList");
		view.addObject("mfrId", mfrId);

		//获取下拉列表数据
		//审核状态
		List<KeyValueVO> searchAudStsCdList = this.prdSplInfoService.searchAudStsCdList();
		view.addObject("searchAudStsCdList", searchAudStsCdList);
		//事业部
		List<KeyValueVO> searchBuOrgList = this.prdSplInfoService.searchBuOrgCdList();
		view.addObject("searchBuOrgList", searchBuOrgList);
		return view;
	}

	/**
	 * 到详情页面
	 */
	@RequestMapping(value = "/toDetailPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toDetailPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String splAttrCd = request.getParameter("splAttrCd");//供应商属性
		String audStsCd = request.getParameter("audStsCd");//审核状态
		String ischange = request.getParameter("ischange");//变更页签显示标识
		String qualTypCd = request.getParameter("qualTypCd"); //资质类型
		String isFlow = request.getParameter("isFlow"); //是否流程中打开 1：是
		String taskNm = request.getParameter("taskNm");
		String taskDefKey = request.getParameter("taskDefKey");
		String isSpePow = request.getParameter("isSpePow");
		String isShowBigCustomer = request.getParameter("isShowBigCustomer");
		String isBigCustomerFlow = request.getParameter("isBigCustomerFlow");
		Long propId = null ;
		if(StringUtils.isNotEmpty(isSpePow) && "1".equals(isSpePow)){
			propId = Long.valueOf(id);
			SplPropInfoDTO propInfoDTO = this.splPropInfoApiService.getById(propId);
			id = propInfoDTO.getSplId().toString();
		}
		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoDetail");
		view.addObject("isFlow",isFlow);
		view.addObject("propId",propId);
		//厂商
		/*List<KeyValueVO> mfrKVList = this.prdSplInfoService.searchMfrKVList();
		JSONArray mfrJson = JSONArray.fromObject(mfrKVList.toArray());
		view.addObject("mfrJson", mfrJson);*/
		//品牌
		/*List<KeyValueVO> brandList = this.prdSplInfoService.searchBrandList();
		JSONArray brJson = JSONArray.fromObject(brandList.toArray());
		view.addObject("brJson", brJson);*/
		if(StringUtils.isEmpty(splAttrCd)){
			SplInfoVO selectById = this.prdSplInfoService.selectById(Long.valueOf(id));
			splAttrCd = selectById.getSplAttrCd();
		}
		if (StringUtils.isEmpty(qualTypCd)) {
			SplInfoVO selectById = this.prdSplInfoService.selectById(Long.valueOf(id));
			qualTypCd = selectById.getQualTypCd();
		}

		view.addObject("qualTypCd", qualTypCd);

		view.addObject("splAttrCd", splAttrCd);

		view.addObject("currentUserId", CurrentThreadContext.getCurrentUserId());

		view.addObject("id", id);

		view.addObject("ischange", ischange);
		view.addObject("isShowBigCustomer",isShowBigCustomer);//是否显示大客户业务选项

		String isShowAuditBtn = request.getParameter("isShowAuditBtn");
		view.addObject("isShowAuditBtn", isShowAuditBtn);

		//维护供应商支持流程关系
		String saveBizFlowRl = request.getParameter("saveBizFlowRl");
		view.addObject("saveBizFlowRl", saveBizFlowRl);
		String saveNoSpNum = request.getParameter("saveNoSpNum");
		view.addObject("saveNoSpNum", saveNoSpNum);
		String isShowSave = request.getParameter("isShowSave");
		view.addObject("isShowSave", isShowSave);

		String mdfFile = request.getParameter("mdfFile");
		view.addObject("mdfFile",mdfFile);
		//add 2017-8-8 14:25:22 by jiangzg
		if(StringUtils.isNotEmpty(isFlow) && BaseConstant.IS_YESNO_YES_STR.equals(isFlow) && StringUtils.isNotEmpty(taskDefKey)){
			String[] splitBranchKey = taskDefKey.split("_");
			view.addObject("currentBuOrgCd", splitBranchKey[1]);
		}else{
			view.addObject("currentBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		}
		// 是否显示合同续签页签
		if (CurrentThreadContext.getCurrentBuOrgCd().equals("0000") ||
				CurrentThreadContext.getCurrentBuOrgCd().equals("00000001")) {
			view.addObject("isShowSplRenewProtocol", BaseConstant.IS_YESNO_YES);
		} else {
			view.addObject("isShowSplRenewProtocol", BaseConstant.IS_YESNO_NO);
		}
      /*  SysUlFilesRecQueryCondition qc = new SysUlFilesRecQueryCondition();
        qc.setPkId(id);
        qc.setTabNm("SPL_BSC_INFO");
        qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
        List<SysUlFilesRecVO> list = sysUlFilesRecService.searchList(qc);
        String serverPath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);//服务地址
		String customerPah = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		view.addObject("defImg", serverPath+customerPah);
        view.addObject("fileList", list);*/
		if("FLOW_0000_003_002_001".equals(taskDefKey) && "信审中心审核".equals(taskNm)){
			view.addObject("audStsCd",1 );
			SplInfoDTO splInfoDTO = this.splExtInfoApiService.selectPrdSplInfonById(Long.valueOf(id), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
			SplExtInfoDTO splExtInfoDTO = splInfoDTO.getSplExtInfoDTO();
			BaseLogUtils.newWebLogger("扩展表对象splExtInfo==>" + JSON.toJSONString(splExtInfoDTO)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();

			if (null != splExtInfoDTO) {
				String importDataSource = splExtInfoDTO.getImportDataSource();
				Integer importDataIsChange = splExtInfoDTO.getImportDataIsChange();
				if (StringUtils.isNotEmpty(importDataSource)
						&& importDataSource.equals(SplGrpRelInfoSrcEnum.SRC_QIANHAI.getRelInfoSrc())
						&& StringUtils.isNotEmpty(importDataIsChange)
						&& importDataIsChange == BaseConstant.IS_YESNO_NO) {
					view.addObject("importDataNm", "带入");
				} else {
					view.addObject("importDataNm", "手填");
				}
			} else {
				view.addObject("importDataNm", "手填");
			}
			view.addObject("isFlow",1);
		}else{
			/*if(StringUtils.isEmpty(audStsCd)){
				view.addObject("audStsCd",0 );
			}else{
				view.addObject("audStsCd",audStsCd );
			}*/
			view.addObject("audStsCd",0 );
			view.addObject("isFlow",isFlow);
		}

		String isWarnCheck = request.getParameter("isWarnCheck");
		view.addObject("isWarnCheck", isWarnCheck);

		String warnRecId = request.getParameter("warnRecId");//高风险预警记录ID
		view.addObject("warnRecId", warnRecId);

        String isRiskWarnFlow = request.getParameter("isRiskWarnFlow");//是否是供应商高风险复议流程审核节点
        view.addObject("isRiskWarnFlow", isRiskWarnFlow);

		String isApply = request.getParameter("isApply");//经销商特殊业务变更中
		view.addObject("isApply", isApply);

		String isModify = request.getParameter("isModify");//经销商特殊业务支持修改
		view.addObject("isModify", isModify);

        String noStartFlow = request.getParameter("noStartFlow");//经销商准入时维护特殊业务标识
        view.addObject("noStartFlow", noStartFlow);

        //商家端经销商准入流程信审审核节点标识
        String isCreditReviewNode = request.getParameter("isCreditReviewNode");
        if (BaseConstant.IS_YESNO_YES_STR.equals(isCreditReviewNode)) {
            view.addObject("isCreditReviewNode", isCreditReviewNode);
        }

		return view;
	}

	/**
	 * 到汽贸城列表页面
	 */
	@RequestMapping(value = "/toChooseAtcPage.do", method = { RequestMethod.GET })
	public ModelAndView toChooseAtcPage(HttpServletRequest request,
										HttpServletResponse response) {
		ModelAndView view = new ModelAndView(
				"product/splInfo/splAtcChooseBscInfoList");
		return view;
	}

	/**
	 * 汽贸城列表
	 */
	@ResponseBody
	@RequestMapping(value = "/toAtcListPage.do", method = { RequestMethod.GET})
	public Object toAtcListPage(HttpServletRequest request, HttpServletResponse response) {
		String atNm = request.getParameter("atNm");
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		AtcBscInfoQueryCondition qc = new AtcBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(atNm)) {
			qc.setAtNm(atNm);  //汽贸城名称  模糊查询
		}
		qc.setStatus(AtcBscInfoConstant.IS_STATUS_0);
		qc.setIsDel(BaseConstant.IS_YESNO_NO);
		page.setCondition(qc);
		Pager pager = this.atcBscInfoService.searchListPage(page);
		List<AtcBscInfoVO> list = (List<AtcBscInfoVO>) pager.getResultList();
		ListPageVO<AtcBscInfoVO> listPage = new ListPageVO<AtcBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 到新增/修改页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoAdd");
		String id = request.getParameter("id");
		String mfrId = request.getParameter("mfrId");
		String splNm = request.getParameter("splNm");
		String lxxz = request.getParameter("lxxz");
		String prdmarks = request.getParameter("prdmarks");
		String succ = request.getParameter("succ");
		String sign = request.getParameter("sign");
		String splAttrCd = request.getParameter("splAttrCd");//供应商属性 add by zhaoyong
		String qualTypCd = request.getParameter("qualTypCd");//资质类型
		String isSplNmModify = request.getParameter("isSplNmModify");
		String isFlow = request.getParameter("isFlow");
		String isModify = request.getParameter("isModify");
		String isApply = request.getParameter("isApply");
		String isShowBigCustomer = request.getParameter("isShowBigCustomer");

		//专车供应商类型 jiangzg add 2017-7-31 16:21:51
		List<KeyValueVO> kvList = new ArrayList<>();
		List<SysDictionaryDTO> sysDictionaryDTOList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.SPL_TYP_GRP_CD);
		if (CollectionUtils.isNotEmpty(sysDictionaryDTOList)) {
			for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOList) {
				KeyValueVO keyValueVO = new KeyValueVO();
				keyValueVO.setKey(sysDictionaryDTO.getCode());
				keyValueVO.setValue(sysDictionaryDTO.getCodeNm());
				kvList.add(keyValueVO);
			}
		}
		String mdfFile = request.getParameter("mdfFile");
		view.addObject("mdfFile",mdfFile);
		view.addObject("isModify",isModify);
		view.addObject("isApply",isApply);
		view.addObject("searchSplTypCdList", JSONArray.fromObject(kvList.toArray()));
		view.addObject("currentBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("id", id);
		//view.addObject("splAttrCd", splAttrCd);
		view.addObject("mfrId", mfrId);
		view.addObject("splNm", splNm);
		view.addObject("lxxz",lxxz);
		view.addObject("prdmarks",prdmarks);
		view.addObject("succ", succ);
		view .addObject("sign",sign);
		view.addObject("qualTypCd",qualTypCd);
		view.addObject("isSplNmModify",isSplNmModify);
		view.addObject("isFlow",isFlow);
		view.addObject("isShowBigCustomer",isShowBigCustomer);//是否显示特殊业务中大客户业务
		if(StringUtils.isNotEmpty(isSplNmModify) && isSplNmModify.equals("0")){
			view.addObject("importDataSource", SplGrpRelInfoSrcEnum.SRC_QIANHAI.getRelInfoSrc());
		}else{
			view.addObject("importDataSource", SplGrpRelInfoSrcEnum.SRC_INNER.getRelInfoSrc());
		}

		//供应商流程呈报人节点传递此参数,控制供应商账号如果走的流程跟供应商是一个流程则允许修改
		String allowMdfBank = request.getParameter("allowMdfBank");
		view.addObject("allowMdfBank", allowMdfBank);
		String proIntId = request.getParameter("processInstanceId");//流程实例ID
		view.addObject("proIntId", proIntId);

		//获取下拉框选项
		//厂商
		List<KeyValueVO> mfrKVList = this.prdSplInfoService.searchMfrKVList();
		JSONArray mfrJson = JSONArray.fromObject(mfrKVList.toArray());
		view.addObject("mfrJson", mfrJson);

		//公司归属
		List<KeyValueVO> ownerKVList = this.prdSplInfoService.searchOwnerCdList();
		view.addObject("ownerKVList", JSON.toJSON(ownerKVList));

		//区域


		//万元美元
		List<KeyValueVO> capUntCdList = this.prdSplInfoService.searchCapUntCdList();
		view.addObject("capUntCdList", capUntCdList);
		//品牌
		List<KeyValueVO> tkBrCdList = this.prdSplInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_TK);
		List<KeyValueVO> carBrCdList = this.prdSplInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_CAR);
		List<KeyValueVO> busBrCdList = this.prdSplInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_BUS);

		JSONArray tkBrCdListJSON = JSONArray.fromObject(tkBrCdList.toArray());
		JSONArray carBrCdListJSON = JSONArray.fromObject(carBrCdList.toArray());
		JSONArray busBrCdListJSON = JSONArray.fromObject(busBrCdList.toArray());
		view.addObject("tkBrCdListJSON", tkBrCdListJSON);
		view.addObject("carBrCdListJSON", carBrCdListJSON);
		view.addObject("busBrCdListJSON", busBrCdListJSON);
		//企业性质
		List<KeyValueVO> corpTypCdList = this.prdSplInfoService.searchCorpTypCdList();
		view.addObject("corpTypCdList", corpTypCdList);
		//事业部
		List<KeyValueVO> searchBuOrgList = this.prdSplInfoService.searchBuOrgCdList();
		JSONArray buOrgCdsJson = JSONArray.fromObject(searchBuOrgList.toArray());
		view.addObject("buOrgCdsJson", buOrgCdsJson);
		//项目类型
		List<KeyValueVO> prjTypCdList = this.prdSplInfoService.searchPrjTypCdList();
		view.addObject("prjTypCdsJson", JSONArray.fromObject(prjTypCdList));
		//供应商级别
		List<KeyValueVO> splLvlCdList = this.prdSplInfoService.searchSplLvlCdList();
		view.addObject("splLvlCdList", splLvlCdList);
		List<KeyValueVO> prjLvlCdList = this.prdSplInfoService.searchPrjLvlCdList();
		view.addObject("prjLvlCdList", prjLvlCdList);
		List<KeyValueVO> searchNewCarTyp = this.prdSplInfoService.searchNewCarTyp();
		view.addObject("newCarTypJSON", JSONArray.fromObject(searchNewCarTyp.toArray()));
		List<KeyValueVO> searchUsedCarTyp = this.prdSplInfoService.searchUsedCarTyp();
		view.addObject("usedCarTypJSON", JSONArray.fromObject(searchUsedCarTyp.toArray()));
		//经营范围
		List<KeyValueVO> searchBizScopeTyp = this.prdSplInfoService.searchBizScopeTyp();
		view.addObject("bizScopeTypJSON",JSON.toJSON(searchBizScopeTyp));

		//档案协议编号
		//view.addObject("fileNo",new Date().toString());
		SplInfoVO splInfoVO = null ;
		if(StringUtils.isNotBlank(id)){
			splInfoVO = this.prdSplInfoService.selectById(Long.valueOf(id));
			String mfrIdsString = splInfoVO.getMfrIdsString();
			String mfrNms = splInfoVO.getMfrNms();
			view.addObject("mfrIdsString",mfrIdsString);
			view.addObject("mfrNms",mfrNms);
		}
		if(StringUtils.isEmpty(splAttrCd) && splInfoVO != null){
			splAttrCd = splInfoVO.getSplAttrCd();
		}
		view.addObject("splAttrCd", splAttrCd);
		if(null != splInfoVO){
			view.addObject("splAttrCd", StringUtils.isNotEmpty(splAttrCd) ? splAttrCd : splInfoVO.getSplAttrCd());
		}
		if(StringUtils.isEmpty(id)){	//如果id为空,添加页面
			//获取当前登录人事业部
			String buOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			int length = SysOrgConstant.SYS_ORG_CD_LENGTH * SysOrgConstant.SYS_BU_ORG_CD_LVL;
			if(buOrgCd.length() == length){
				view.addObject("buOrgCd",buOrgCd );
			}
		}
		view.addObject("currBuOrgCd",CurrentThreadContext.getCurrentBuOrgCd() );

		//证件类型
		List<KeyValueVO> certTypCdList = this.splRlPsnService.searchCertTypCdList();
		view.addObject("certTypCdListJSON", JSON.toJSON(certTypCdList));
		//联系人类型
		List<KeyValueVO> rlTypCDList;
		if ("1".equals(splAttrCd)) {
			rlTypCDList = this.splNpSocialRlService.searchRlTypCdList(DictionaryConstant.CODE_GRP_RL_TYP_CD);
		} else {
			rlTypCDList = this.splRlPsnService.searchRlTypCdList();
		}
		view.addObject("rlTypCDListJSON", JSON.toJSON(rlTypCDList));

		//必填联系人类型
        List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE_RL_TYP_CD);
        List<String> mustAddRlPsns = null ;
        List<String> noAddRlPsns = null ;
        if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
            mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            noAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
                if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
					mustAddRlPsns.add(dto.getCode());
				}else if(2 == dto.getIsSysDef()){
					noAddRlPsns.add(dto.getCode());
				}
            }
        }
        view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null :JSON.toJSON(mustAddRlPsns));
        view.addObject("noAddRlPsnTypCdJSON", null == noAddRlPsns ? null :JSON.toJSON(noAddRlPsns));

		String isShowAuditBtn = request.getParameter("isShowAuditBtn");
		view.addObject("isShowAuditBtn", isShowAuditBtn);

		view.addObject("currOrgCd", CurrentThreadContext.getCurrentOrgCd());
		view.addObject("currBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		//TODO 2017-8-4 by YAOXIURONG	如果是修改跳转需要查询此供应商在其他事业部是否有审核中/审核通过的流程 如果有 只允许修改当前事业部特殊字段
		String onlyMdfFlag = "0";//0:都可修改    1:只可修改当前事业部特殊字段
		if(StringUtils.isNotEmpty(id)){
			SysFlowSHQueryCondition condition = new SysFlowSHQueryCondition();
			condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
			condition.setDataId(Long.valueOf(id));
			condition.setWordsInTheTable(SplInfoConstant.SPL_FLOW_S_H_SPL);
			condition.setBusTyp(FlowConstant.FLOW_MODEL_TYP_SPL_ACCESS);
			condition.setStatus(BaseConstant.IS_YESNO_YES);
			List<SysFlowSHDTO> flowSHDTOList = this.flowApiService.searchFlowSHDTOList(condition);
			if(CollectionUtils.isNotEmpty(flowSHDTOList)){
				for (SysFlowSHDTO sysFlowSHDTO : flowSHDTOList) {
					if(FlowConstant.FLOW_CHECK_STATE_IN.equals(sysFlowSHDTO.getAudStsCd())
							|| FlowConstant.FLOW_CHECK_STATE_PASS.equals(sysFlowSHDTO.getAudStsCd())
							|| FlowConstant.FLOW_CHECK_STATE_REJECT.equals(sysFlowSHDTO.getAudStsCd())){
						onlyMdfFlag = "1";
					}
				}
			}
		}
		view.addObject("onlyMdfFlag", onlyMdfFlag);
        String taskDefKey = request.getParameter("taskDefKey");

		return view;
	}

	/**
	 * 刷新品牌下拉框数据
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/getBrCdsData.do", method = {RequestMethod.POST })
	@ResponseBody
	public JSONArray getBrCdsData(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String buOrgCds = request.getParameter("buOrgCds");
		List<String> sCodeList = new ArrayList<String>();
		if(StringUtils.isNotEmpty(buOrgCds)){
			String[] strings = buOrgCds.split(";");
			for (String orgCd : strings) {
				List<SysDictionaryDTO> searchGroupList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(),orgCd, DictionaryConstant.CODE_PRD_TYP_CATEGORY);
				if(CollectionUtils.isNotEmpty(searchGroupList)){
					for (SysDictionaryDTO sysDictionaryDTO : searchGroupList) {
						String code = sysDictionaryDTO.getCode();
						if(!sCodeList.contains(code)){
							sCodeList.add(code);
						}
					}
				}
			}
		}
		String mTypCd = "M0002";
		//String sGrpCd = DictionaryConstant.CODE_PRD_TYP_CATEGORY;
		SysCdMapDQueryCondition condition = new SysCdMapDQueryCondition();
		try {
			List<KeyValueVO> brCdKVList = new ArrayList<KeyValueVO>();
			if(CollectionUtils.isNotEmpty(sCodeList)){
				//1、系统代码 2、组织架构代码 3、映射类型代码(代码映射表中) 4、原代码组值(代码映射表中) 5、原代码值(代码映射表中)
				condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
				condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				condition.setmTypCd(mTypCd);
				/*condition.setsGrpCd(sGrpCd);*/
				condition.setsCodeList(sCodeList);
				List<SysCdMapDVO> list = this.prdSplInfoService.searchSysCdMapDList(condition);
				if(CollectionUtils.isNotEmpty(list)){
					for (SysCdMapDVO sysCdMapDVO : list) {
						KeyValueVO kv = new KeyValueVO();
						kv.setKey(sysCdMapDVO.getTCode());
						kv.setValue(sysCdMapDVO.getTCodeNm());
						brCdKVList.add(kv);
					}
				}
			}
			JSONArray brCdJSON = JSONArray.fromObject(brCdKVList);
			BaseLogUtils.newWebLogger("刷新品牌下拉框数据,ID:").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();

			return brCdJSON;
		}catch (BaseException ex) {
			BaseLogUtils.newWebLogger("刷新品牌下拉框数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			BaseLogUtils.newWebLogger("刷新品牌下拉框数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}

		return null;
	}

	/**
	 * 动态组件页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toAddDynamicPage.do", method = { RequestMethod.GET,RequestMethod.POST })
	public ModelAndView toAddDynamicPage(HttpServletRequest request, HttpServletResponse response) {
		String buOrgCds = request.getParameter("buOrgCds");
		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoAddDynamicPage");

		List<String> orgCds = new ArrayList<>();
		if(StringUtils.isNotEmpty(buOrgCds)){
			String[] strings = buOrgCds.split(";");
			for (String string : strings) {
				orgCds.add(string);
			}
		}

		view.addObject("orgCds", orgCds);
		return view;
	}
	@RequestMapping(value = "/toDetailDynamicPage.do", method = { RequestMethod.GET,RequestMethod.POST })
	public ModelAndView toDetailDynamicPage(HttpServletRequest request, HttpServletResponse response) {
		String buOrgCds = request.getParameter("buOrgCds");
		ModelAndView view = new ModelAndView("product/splInfo/prdSplInfoDetailDynamicPage");

		List<String> orgCds = new ArrayList<>();
		buOrgCds = buOrgCds.substring(1, buOrgCds.length()-1);
		if(StringUtils.isNotEmpty(buOrgCds)){
			String[] strings = buOrgCds.split(",");
			for (String string : strings) {
				orgCds.add(string.substring(1, string.length()-1));
			}
		}

		view.addObject("orgCds", orgCds);
		return view;
	}
	/**
	 * 到供应商校验页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toCheckSplPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toCheck(HttpServletRequest request, HttpServletResponse response) {
		String mfrId = request.getParameter("mfrId");
		String lxxz = request.getParameter("lxxz");
		String prdmarks = request.getParameter("prdmarks");
		ModelAndView view = new ModelAndView("product/splInfo/prdSplCheck");
		// 客户类型  add by zhaoyong begin
		List<KeyValueVO> csttypcdlist = this.cstBscInfoService.searchCstTypCdList();
		view.addObject("searchSelectCsttypcdlist", csttypcdlist);
		view.addObject("mfrId", mfrId);
		view.addObject("lxxz",lxxz);
		view.addObject("prdmarks",prdmarks);
		return view;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Object initSplList(HttpServletRequest request, HttpServletResponse response) {
		try {
			String currentPage = request.getParameter("page");
			String pageSize = request.getParameter("pagesize");
			String mfrId = request.getParameter("mfrId");

			String splNm = request.getParameter("splNm");
			String audStsCd = request.getParameter("audStsCd");
			String buOrgCd = request.getParameter("buOrgCd");
			String rgnProvCd = request.getParameter("rgnProvCd");//区域-省
			String rgnCityCd = request.getParameter("rgnCityCd");//区域-市
			String splIdString = request.getParameter("splIdString");//报价方案属性配置中配置的供应商IDS

			String flag = request.getParameter("flag");//被引用为下拉框数据标识 (方案配置属性)
			String condition = request.getParameter("condition");
			String searchflag = request.getParameter("searchflag");
			String splTypCd = request.getParameter("splTypCd");
			String atcId = request.getParameter("atcId");
			String splAttrCd = request.getParameter("splAttrCd");// 供应商属性

			//续签协议相关
			String protocolTmStar = request.getParameter("protocolTmStar");//协议到期日期-开始日期
			String protocolTmEnd = request.getParameter("protocolTmEnd");//协议到期日期-结束日期
			String isValid = request.getParameter("isValid");//协议有效状态
			String reAssignTmStar = request.getParameter("reAssignTmStar");//协议续签日期-开始日期
			String reAssignTmEnd = request.getParameter("reAssignTmEnd");//协议续签日期-结束日期
			String effectiveTmStar = request.getParameter("effectiveTmStar");//协议生效日期-开始日期
			String effectiveTmEnd = request.getParameter("effectiveTmEnd");//协议生效日期-结束日期

            String splSource = request.getParameter("splSource"); //经销商来源，例如：CHL0014

			String isEncrypt = request.getParameter("isEncrypt");

			String guarCd = request.getParameter("guarCd");//渠道担保业务
			String compEffectIsValid = request.getParameter("compEffectIsValid");//代偿担保协议是否生效

			String value = "";
			Integer isQuery = 0 ;
			if(StringUtils.isNotBlank(condition)){
				String con = condition.substring(1, condition.length()-1);
				if(StringUtils.isNotBlank(con)){
					net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(con);
					value = (String) fromObject.get("value");
				}
			}

			Pager page = new Pager();
			if (StringUtils.isNotEmpty(currentPage)) {
				page.setCurrentPage(Integer.parseInt(currentPage));
			}

			if (StringUtils.isNotEmpty(currentPage)) {
				page.setEveryPage(Integer.parseInt(pageSize));
			}

			SplInfoQueryCondition qc = new SplInfoQueryCondition();
			qc.setIsDel(BaseConstant.IS_YESNO_NO);
			if (StringUtils.isNotBlank(mfrId)) {
				qc.setMfrId(Long.valueOf(mfrId));
			}
			if (StringUtils.isNotBlank(atcId)) {
				qc.setAtcId(Long.valueOf(atcId));
			}
			if (StringUtils.isNotBlank(splNm)) {
				qc.setSplNm(splNm);
			}
			if (StringUtils.isNotBlank(splAttrCd)) {
				qc.setSplAttrCd(splAttrCd);
			}
			if (StringUtils.isNotBlank(audStsCd)) {
				qc.setAudStsCd(audStsCd);
			}
			if (StringUtils.isNotBlank(buOrgCd)) {
				qc.setBuOrgCd(buOrgCd);
			}
			if(StringUtils.isNotEmpty(rgnProvCd)){
				qc.setRgnPrCd(rgnProvCd);
			}
			if(StringUtils.isNotEmpty(rgnCityCd)){
				qc.setRgnCyCd(rgnCityCd);
			}

			if (StringUtils.isNotEmpty(flag)) {
				if(StringUtils.isEmpty(value)&&StringUtils.isEmpty(splIdString)){//被引用为下拉框却没有查询条件返回null
					return null;
				}
				page.setEveryPage(Integer.MAX_VALUE);//最大数据量
				//qc.setAudStsCd(BaseConstant.FLOW_CHECK_STATE_PASS);//审核通过
			}
			if (StringUtils.isNotEmpty(value)) {
				qc.setSplNm(value.trim());
			}else if(StringUtils.isNotEmpty(splIdString)){
				String[] strings = splIdString.trim().split(";");
				List<Long> splIds = new ArrayList<Long>();
				for (String string : strings) {
					splIds.add(Long.valueOf(string));
				}
				qc.setIds(splIds);
			}
			if (StringUtils.isNotEmpty(splTypCd)) {
				qc.setSplTypCd(splTypCd);
			}

			if(StringUtils.isNotEmpty(protocolTmStar)){
				qc.setProtocolTmStar(protocolTmStar);
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(protocolTmEnd)){
				qc.setProtocolTmEnd(protocolTmEnd);
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(isValid)){
				qc.setIsValid(Integer.parseInt(isValid));
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(reAssignTmStar)){
				qc.setReAssignTmStar(reAssignTmStar);
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(reAssignTmEnd)){
				qc.setReAssignTmEnd(reAssignTmEnd);
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(effectiveTmStar)){
				qc.setEffectiveTmStar(effectiveTmStar);
				isQuery = 1 ;
			}
			if(StringUtils.isNotEmpty(effectiveTmEnd)){
				qc.setEffectiveTmEnd(effectiveTmEnd);
				isQuery = 1 ;
			}
			qc.setIsQuery(isQuery);
			if(StringUtils.isNotEmpty(splSource)){
			    qc.setSplSource(splSource);
            }
			String isBlackList = request.getParameter("isBlackList") ;
			if(StringUtils.isEmpty(isBlackList)){
				isBlackList = BaseConstant.IS_YESNO_NO_STR ;
			}
			/**
			 * 渠道代偿新增  2021-1-18 19:33:00
			 * */
			if(StringUtils.isNotEmpty(guarCd)){
				qc.setGuarCd(guarCd);
			}
			if(StringUtils.isNotEmpty(compEffectIsValid)){
				qc.setCompEffectIsValid(Integer.valueOf(compEffectIsValid));
			}
			qc.setIsBlackList(Integer.valueOf(isBlackList));
			page.setCondition(qc);
			BaseLogUtils.newWebLogger("初始化供应商列表页面数据.DATA:"+JSONObject.toJSONString(page)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			Pager pager = null;
			if (StringUtils.isNotEmpty(isEncrypt) && BaseConstant.IS_YESNO_YES_STR.equals(isEncrypt)) {
				String roleisEncrypt = this.sysDictionaryService.getRoleisEncrypt();
				if (BaseConstant.IS_YESNO_YES_STR.equals(roleisEncrypt)) {
					pager = this.prdSplInfoService.searchListPageWithEncrypt(page);
				} else {
					pager = this.prdSplInfoService.searchListPage(page);
				}
			} else {
				pager = this.prdSplInfoService.searchListPage(page);
			}

			BaseLogUtils.newWebLogger("获取供应商列表页面数据.DATA:"+JSONObject.toJSONString(pager)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			List<SplInfoVO> list = (List<SplInfoVO>) pager.getResultList();
			ArrayList<Long> ids = new ArrayList<>();
			for (SplInfoVO splInfoVO : list) {
				ids.add(splInfoVO.getId());
			}
			SplRenewProtocolRecQC protocolRecQC = new SplRenewProtocolRecQC();
			protocolRecQC.setSplIdList(ids);
			protocolRecQC.setIsNew(1);
			protocolRecQC.setIsDel(0);

			List<SplRenewProtocolRecDTO> list2 = this.splRenewProtocolRecApiService.searchSplRePtlRecDTOList(protocolRecQC);
			Long l = 0L ;
			for (SplInfoVO vo : list) {
				for (SplRenewProtocolRecDTO dto : list2) {
					if(dto.getSplId() != null && dto.getSplId().equals(vo.getId())){
						l = 0L;
						if(dto.getProtocolEndTm() != null){
							l = DateUtils.getDaysBetweenTwoDates(new Date(), dto.getProtocolEndTm());
						}
						if(l >0 && l < 15){
							vo.setIsRemind(2);
						}else if(l < 0){
							vo.setIsRemind(1);
						}else{
							vo.setIsRemind(0);
						}

						vo.setEffectiveTm(DateUtils.formatDateToString(dto.getEffectiveTm(), DateUtils.YYYY_MM_DD));
						vo.setRenewStsCd(dto.getRenewStsCd());
						vo.setReAssignTm(DateUtils.formatDateToString(dto.getReAssignTm(), DateUtils.YYYY_MM_DD));
						vo.setProtocolEndTm(DateUtils.formatDateToString(dto.getProtocolEndTm(), DateUtils.YYYY_MM_DD));
						vo.setIsValid(dto.getIsValid());
						vo.setProtocolId(dto.getId());
					}
				}
			}

			//初始化供应商星级信息
			Map<String, String> starLevelMap = sysDictionaryApiService.searchGroupToMap(SplSystemConstant.SPL_SYS_CD, SplSystemConstant.DEFAULT_ORG_CD, SplRateRelInfoConstant.SPL_RATE_STAR_DIC_CD);
			StringBuilder rpcSign = new StringBuilder();
			rpcSign.append(System.currentTimeMillis()).append("_").append(CurrentThreadContext.getCurrentUserName()).append("_").append(CurrentThreadContext.getCurrentUserId());
			SplRateRelInfoQC splRateRelInfoQC = new SplRateRelInfoQC();
			splRateRelInfoQC.setDataIdList(ids);
			splRateRelInfoQC.setTabNm("SPL_BSC_INFO");
			splRateRelInfoQC.setIsNew(BaseConstant.IS_YESNO_YES);
			splRateRelInfoQC.setIsDel(BaseConstant.IS_YESNO_NO);
			splRateRelInfoQC.setIsValid(BaseConstant.IS_YESNO_YES);
			DataResultDTO resultDTO = this.splRateRelInfoQueryApiService.searchSplRateRelInfoDTOList(splRateRelInfoQC,SplSystemConstant.FL_WEB_CHL_CD, null,rpcSign.toString());
			BaseLogUtils.newWebLogger("查询供应商星级信息.DATA:"+JSONObject.toJSONString(resultDTO)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			if(BaseConstant.IS_YESNO_YES == resultDTO.getSuccess()){
				List<SplRateRelInfoDTO> splRateInfoList = (List<SplRateRelInfoDTO>)resultDTO.getData() ;
				if(CollectionUtils.isNotEmpty(splRateInfoList)){
					Map<Long,Long> splIdByStarLevelMap = new HashMap<>();
					for (SplRateRelInfoDTO rateRelDTO:splRateInfoList) {
						splIdByStarLevelMap.put(rateRelDTO.getDataId(),rateRelDTO.getStarLevel());
					}
					for (SplInfoVO vo:list) {
						Long levelCd = splIdByStarLevelMap.get(vo.getId());
						if(StringUtils.isNotEmpty(levelCd)) {
							vo.setStarLevelNm(starLevelMap.get(levelCd.toString()));
						}
					}
				}
			}
			BaseLogUtils.newWebLogger("返回页面数据.DATA:"+JSONObject.toJSONString(list)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();



			ListPageVO<SplInfoVO> listPage = new ListPageVO<>(list, pager.getTotalCount());


			return listPage;
		} catch (BaseException e) {
			BaseLogUtils.newWebLogger("初始化供应商列表页面失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
			e.printStackTrace();
		} catch (Exception e) {
			BaseLogUtils.newWebLogger("初始化供应商列表页面失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			e.printStackTrace();
		}
		return null;
	}

	/**
	 * 获取历史流程记录
	 */
	@RequestMapping(value = "/getSplSHFlowInfo.do", method = { RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Object getSplSHFlowInfo(HttpServletRequest request, HttpServletResponse response) {
		HashMap<String,Object> result = new HashMap<>();
		result.put("is_Flow_yesOrNo", "no");
		String id = request.getParameter("id");
		String busTyp = request.getParameter("busTyp");
//		String audStsCdNm = request.getParameter("audStsCdNm");
		String audStsCd = request.getParameter("audStsCd");
		SysFlowSHQueryCondition sysFlowSHQueryCondition = new SysFlowSHQueryCondition();
		sysFlowSHQueryCondition.setBusTyp(busTyp);
		sysFlowSHQueryCondition.setDataId(Long.valueOf(id));
		sysFlowSHQueryCondition.setSysCd(WebBaseConstant.SYS_SYS_CD);
		sysFlowSHQueryCondition.setWordsInTheTable(SplInfoConstant.SPL_FLOW_S_H_SPL);
		sysFlowSHQueryCondition.setAudStsCd(audStsCd);
		List<SysFlowSHDTO> sysFlowSHDTOs = flowApiService.searchFlowSHDTOList(sysFlowSHQueryCondition);
		if(sysFlowSHDTOs != null && sysFlowSHDTOs.size() > 0){
			result.put("is_Flow_yesOrNo","yes");
			SysFlowSHDTO sysFlowSHDTO = sysFlowSHDTOs.get(0);
			result.put("sysFlowSHDTO",sysFlowSHDTO);
		}
		return result ;
	}


	/**
	 * 校验供应商是否存在
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkSpl.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object checkSpl(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String splNm = request.getParameter("splNm");
		String succ = request.getParameter("succ");
		String splAttrCd = request.getParameter("splAttrCd");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(splNm)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger("校验供应商是否已存在失败,供应商名称为空！splNm:").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}

		try {
			SplInfoVO prdSplInfoVO = this.prdSplInfoService.checkSplExist(splNm, succ);

			if (!"1".equals(splAttrCd)) {
				SplCommBasicQC condition = new SplCommBasicQC();
				condition.setEntname(splNm);
				//SplCommBasicVO splCommBasicVO = this.splCommBasicService.getCommInfoByNameAndType("2", splNm, 2, null);
				//2020-06-09 18:42:58 三方接口关停
				//HsjBasicDTO hsjBasicDTO = this.hsjQueryService.getCommInfoByNameAndType("1", splNm);
				/*String entNm = null;
				if (hsjBasicDTO != null) {
					entNm = hsjBasicDTO.getEntName();
				}*/
				//List<SplCommBasicVO> list = this.splCommBasicService.searchListSplCommBasicVO(condition);
				/*if (StringUtils.isEmpty(entNm) && null == prdSplInfoVO) {
					result.setInfo("0");
					return result;
				} else if (StringUtils.isNotEmpty(entNm) && null == prdSplInfoVO) {
					result.setInfo("1");
					return result;
				} */
				if (null == prdSplInfoVO) {
					result.setInfo("1");
					return result;
				}
			}
			if(null!=prdSplInfoVO){
				result.setData(prdSplInfoVO.getId());
				BaseLogUtils.newWebLogger("校验供应商，流程状态:"+prdSplInfoVO.getAudStsCd()).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.info();
				if(FlowConstant.FLOW_CHECK_STATE_IN.equals(prdSplInfoVO.getAudStsCd())){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("供应商审核中,不允许再次发起流程.");
				}else if(FlowConstant.FLOW_CHECK_STATE_PASS.equals(prdSplInfoVO.getAudStsCd())){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("供应商审核通过,不允许再次发起流程.");
				}
			}
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("获取供应商数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("获取供应商数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeSplById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(ids)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger("删除供应商数据,主键参数为空！").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}

		List<Long> idsList = new ArrayList<Long>();
		JSONArray idsArray = JSONArray.fromObject(ids);
		for (Object object : idsArray) {
			idsList.add(Long.valueOf(object.toString()));
		}

		try {
			boolean success = this.prdSplInfoService.removeByIds(idsList);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
				BaseLogUtils.newWebLogger("删除供应商数据失败,ID:"+idsList.toString()).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
			BaseLogUtils.newWebLogger("删除供应商数据成功,ID:"+idsList.toString()).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("删除供应商数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("删除供应商数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}

		return result;
	}

	/**
	 * 得到一条记录
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getSplById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String splNm = request.getParameter("splNm");
		String splAttrCd = request.getParameter("splAttrCd");
		String opTypCd = request.getParameter("opTypCd");

		String isEncrypt = request.getParameter("isEncrypt");

		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id) && StringUtils.isEmpty(splNm)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger("获取供应商数据,主键参数为空！").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}

		try {
			SplInfoVO vo = null;
			//SplCommBasicVO basicVO = null;
			HsjBasicDTO basicDTO = null ;
			if(StringUtils.isNotEmpty(id)){
				if (StringUtils.isNotEmpty(isEncrypt) && BaseConstant.IS_YESNO_YES_STR.equals(isEncrypt)) {
					String roleisEncrypt = this.sysDictionaryService.getRoleisEncrypt();
					if (BaseConstant.IS_YESNO_YES_STR.equals(roleisEncrypt)) {
						vo = this.prdSplInfoService.selectByIdWithEncrypt(Long.valueOf(id), opTypCd);
					} else {
						vo = this.prdSplInfoService.selectById(Long.valueOf(id),opTypCd);
					}
				} else {
					vo = this.prdSplInfoService.selectById(Long.valueOf(id),opTypCd);
				}
				splAttrCd = vo.getSplAttrCd();
			}else{
				if (!"1".equals(splAttrCd)) {
					//basicVO = this.splCommBasicService.getCommInfoByNameAndType("2", splNm, 2, null);
					//2020-06-09 18:48:03 三方数据关停
					basicDTO = this.hsjQueryService.getCommInfoByNameAndType("1", splNm);
					BaseLogUtils.newWebLogger("查询三方供应商信息,==>>" + JSON.toJSONString(basicDTO)).setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
							.setWarning(false)
							.info();
				}
			}

			/*if (null != vo && "1".equals(splAttrCd)) {
				SplNpBscInfoVO npVo = this.splNpBscInfoService.selectById(Long.valueOf(id));
				if (null != npVo) {
					Long riskRcCstId = npVo.getRiskRcCstId();
					if (StringUtils.isNotEmpty(riskRcCstId)) {
						BaseParamDTO baseParamDTO = new BaseParamDTO();
						baseParamDTO.setSysCd(SplSystemConstant.FL_SYS_CD);
						baseParamDTO.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD);
						baseParamDTO.setServiceCd(SplSystemConstant.SPL_SERVICE_CD);
						baseParamDTO.setFrontCd(SplSystemConstant.FL_WEB_CHL_CD);
						DataResultDTO creditResult = this.riskCtrlSingleApiService
								.searchRcCstBscInfoResult(riskRcCstId, baseParamDTO);
						if (null != creditResult) {
							RiskCtrlSingleResult data = (RiskCtrlSingleResult) creditResult.getData();
							vo.setRskLvlCd(data.getRskLvlName());
							vo.setAudStsDesc(data.getAudStsDesc());
							BaseLogUtils.info(logger, "",
									"在我司库中征信查询结果==>riskRcCstId:" + riskRcCstId + ",result:"
											+ JSONObject.toJSONString(creditResult),
									CurrentThreadContext.getCurrentUserName());
						}
					}
				}
			}*/

			if(null != basicDTO && vo == null){
				// 将三方数据信息放入
				vo = new SplInfoVO();
				vo.setSucc(basicDTO.getCreditCode());
				if(StringUtils.isNotEmpty(basicDTO.getRegCap())){
					vo.setRegCapAmt(Double.valueOf(basicDTO.getRegCap()));
				}
				if(StringUtils.isNotEmpty(basicDTO.getRecCap())){
					vo.setPaidCapAmt(Double.valueOf(basicDTO.getRecCap()));
				}
				vo.setRegAddr(basicDTO.getAddress());
				vo.setRegDt(DateUtils.formatStringToDate(basicDTO.getEsDate(), DateUtils.YYYY_MM_DD));
				//vo.setBizScope(basicVO.getBusiscope1());
				vo.setSplNm(splNm);
				if(StringUtils.isNotEmpty(basicDTO.getRegCapCur()) && basicDTO.getRegCapCur().equals("美元")){
					vo.setRegCapUntCd("3");
					vo.setRegCapUntCdNm("万美元");

					vo.setPaidCapUntCd("3");
					vo.setPaidCapUntCdNm("万美元");
				}
			}
			/*SplCiCfgQC splCiCfgQC = new SplCiCfgQC();
			splCiCfgQC.setSplId(Long.valueOf(id));
			List<SplCiCfgVO> splCiCfgList = this.splCiCfgService.searchList(splCiCfgQC);
			SplCiCfgVO splCiCfgVO = null;
			if (CollectionUtils.isNotEmpty(splCiCfgList)) {
				splCiCfgVO = splCiCfgList.get(0);
			}*/
			//供应商类型 jiangzg add 2017-8-8 14:24:02
			Map<String,String> splTypCdMap = new HashMap<>();
			List<SysDictionaryDTO> sysDictionaryDTOList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.SPL_TYP_GRP_CD);
			if (CollectionUtils.isNotEmpty(sysDictionaryDTOList)) {
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOList) {
					splTypCdMap.put(sysDictionaryDTO.getCode(),sysDictionaryDTO.getCodeNm());
				}
			}
			if(null == vo && StringUtils.isNotEmpty(id)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.newWebLogger("获取供应商数据不存在,ID:"+id).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}else if (null != vo) {
				if(CollectionUtils.isMapNotEmpty(splTypCdMap)){
					if(splTypCdMap.containsKey(vo.getSplTypCd())){
						vo.setSplTypCdNm(splTypCdMap.get(vo.getSplTypCd()));
					}
				}
				// TODO 2018-08-22 16:48:28 殷烈查征信规则需求上线后作废
				if (StringUtils.isEmpty(vo.getIsAuthCrdChk())) {
					vo.setIsAuthCrdChk(0);
				}
				if (StringUtils.isEmpty(vo.getLimChkTms())) {
					vo.setLimChkTms(0);
				}

				if (StringUtils.isEmpty(vo.getSplTel())) {
					vo.setSplTel(vo.getApplyTel());
				}
				if(StringUtils.isNotEmpty(vo.getIsRecycleLoa())){
					vo.setIsRecycleLoaNm(vo.getIsRecycleLoa() == 1? "是":"否");
				}
				if(StringUtils.isNotEmpty(vo.getIsUploadLoa())){
					vo.setIsUploadLoaNm(vo.getIsUploadLoa() == 1? "是":"否");
				}
			}
			/*if (null == splCiCfgVO) {
				vo.setIsEnable(0);// 是否启用征信规则
			} else {
				vo.setIsEnable(splCiCfgVO.getIsEnable());// 是否启用征信规则
				vo.setIsAuthCrdChk(splCiCfgVO.getIsAuthCrdChk());// 是否有权查征信
				vo.setLimChkTms(Integer.valueOf(splCiCfgVO.getLimChkTms().toString()));// 剩余查询征信次数
			}*/
			result.setData(vo);
			//System.out.println("---------------"+JSONObject.toJSONString(vo));
			BaseLogUtils.newWebLogger("获取供应商数据成功,ID:"+id).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("获取供应商数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("获取供应商数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addSpl(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		SplInfoVO entity = new SplInfoVO();
		try {
			entity = this.getRequestParamForPrdSplAdd(request);//获取参数
			entity.setOpStsCd(SplOpStsCdEnum.PASS.getStatus());
			entity.setSplSource(SplSystemConstant.FL_WEB_CHL_CD);
			String importDataSource = request.getParameter("importDataSource");
			entity.setImportDataSource(importDataSource);
			Long id = this.prdSplInfoService.add(entity);
			result.setData(id);
			BaseLogUtils.newWebLogger("新增供应商数据成功,Data:"+JSON.toJSONString(entity)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			String reason = request.getParameter("reason");
			// 插入供应商操作记录
			try {
				if (StringUtils.isNotEmpty(reason)) {
					Long add = this.splOpLogRecService.add(id.toString(), reason, SplRelLogOpTypCdNum.ADD.getOpTypCd(), SplRelLogBizTypCdNum.SPL.getBizTypCd());
					BaseLogUtils.newWebLogger("插入供应商操作记录结果=>" + add).setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
							.setWarning(false)
							.info();
				}
			} catch (BaseException e) {
				BaseLogUtils.newWebLogger("插入供应商操作记录失败,业务异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.setThrowable(e)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增供应商数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增供应商数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifySpl(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_UPDATE_SUCC);
		SplInfoVO entity = new SplInfoVO();
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger("修改供应商信息,主键参数为空").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}
		try {
			entity = this.getRequestParamForPrdSplModify(request);
			entity.setId(Long.valueOf(id));
			boolean success = this.prdSplInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
				BaseLogUtils.newWebLogger("修改供应商数据失败.DATA:"+JSONObject.toJSONString(entity)).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
			BaseLogUtils.newWebLogger("修改供应商数据成功.DATA:"+JSONObject.toJSONString(entity)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("修改供应商数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("修改供应商数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}
	/**
	 * 到修改审核状态页面
	 */
	@RequestMapping(value = "/toModifyAudStsCdPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyAudStsCdPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		ModelAndView view = new ModelAndView("product/splInfo/prdModifyAudStsCd");
		//审核状态
		List<KeyValueVO> searchAudStsCdList = this.prdBscInfoService.searchAudStsCdList1();
		view.addObject("searchAudStsCdList", searchAudStsCdList);
		view.addObject("id", id);
		return view;
	}
	/**
	 * 修改审核状态
	 */
	@RequestMapping(value = "/modifyAudStsCd.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifyAudStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String audStsCd = request.getParameter("audStsCd");
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id) || StringUtils.isEmpty(audStsCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger("修改审核状态,参数不完整").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}
		try {
			boolean success = this.prdSplInfoService.modifyAudStsCd(Long.valueOf(id), audStsCd, new Date(), CurrentThreadContext.getCurrentUserId());
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
			}
			BaseLogUtils.newWebLogger("修改审核状态,ID:"+id+".audStsCd:"+audStsCd).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("修改审核状态失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("修改审核状态失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}

		return result;
	}
	/**
	 * 跳转供应商资料新增页面 1
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toSplFileAddPage.do", method = { RequestMethod.GET})
	public ModelAndView toSplFileAddPage(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");
		String isDetail = request.getParameter("isDetail");
		String splAttrCd = request.getParameter("splAttrCd") ;
		String qualTypCd = request.getParameter("qualTypCd");
		String isApply = request.getParameter("isApply");
		String isCheckVerify = request.getParameter("isCheckVerify");
		ModelAndView view = new ModelAndView("product/splInfo/splFileAdd");
		view.addObject("splId", splId);
		view.addObject("isDetail", isDetail);
		view.addObject("splAttrCd",splAttrCd);
		view.addObject("qualTypCd",qualTypCd);
		view.addObject("isApply",isApply);
		view.addObject("isCheckVerify",isCheckVerify);

		if(StringUtils.isNotEmpty(splId)){
			SplInfoVO splInfo = this.prdSplInfoService.selectById(Long.valueOf(splId));
			splAttrCd = splInfo.getSplAttrCd();
			view.addObject("splAttrCd",splAttrCd);
		}

		//查询附件信息
		String cfgCd = null ;
		String tabNm = null ;
		String cfgOrgCd = null ;
		String cfgSysCd = null ;
		String modulePath = null;
		String rootPath = null ;
		String costomerPath = null ;
		String uploadSysCd = null ;
		if(StringUtils.isNotEmpty(splAttrCd)){
			SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
			if(BaseConstant.IS_YESNO_YES_STR.equals(splAttrCd)){
				//自然人 附件查询
				cfgCd = SplInfoFileCfgEnum.SPL017.getCode() ;
				tabNm = SplInfoFileCfgEnum.SPL017.getTableNm();
				cfgOrgCd = SplInfoFileCfgEnum.SPL017.getOrgCd();
				cfgSysCd = SplInfoFileCfgEnum.SPL017.getSysCd();
				modulePath = SplInfoFileCfgEnum.SPL017.getModulePath();
				costomerPath  = SplInfoFileCfgEnum.SPL017.getUploadCostomerPath();
				rootPath = SplInfoFileCfgEnum.SPL017.getUploadRootPath();
				uploadSysCd = SplInfoFileCfgEnum.SPL017.getUploadSysCd();
			}else{
				//法人 附件查询
				if(StringUtils.isNotEmpty(qualTypCd) && BaseConstant.IS_YESNO_YES_STR.equals(qualTypCd)){
					//非三证合一
					cfgCd = SplInfoFileCfgEnum.SPL006.getCode() ;
					tabNm = SplInfoFileCfgEnum.SPL006.getTableNm();
					cfgOrgCd = SplInfoFileCfgEnum.SPL006.getOrgCd();
					cfgSysCd = SplInfoFileCfgEnum.SPL006.getSysCd();
					modulePath = SplInfoFileCfgEnum.SPL006.getModulePath();
					costomerPath  = SplInfoFileCfgEnum.SPL006.getUploadCostomerPath();
					rootPath = SplInfoFileCfgEnum.SPL006.getUploadRootPath();
					uploadSysCd = SplInfoFileCfgEnum.SPL006.getUploadSysCd();
				}else{
					//三证合一
					cfgCd = SplInfoFileCfgEnum.SPL005.getCode() ;
					tabNm = SplInfoFileCfgEnum.SPL005.getTableNm();
					cfgOrgCd = SplInfoFileCfgEnum.SPL005.getOrgCd();
					cfgSysCd = SplInfoFileCfgEnum.SPL005.getSysCd();
					modulePath = SplInfoFileCfgEnum.SPL005.getModulePath();
					costomerPath  = SplInfoFileCfgEnum.SPL005.getUploadCostomerPath();
					rootPath = SplInfoFileCfgEnum.SPL005.getUploadRootPath();
					uploadSysCd = SplInfoFileCfgEnum.SPL005.getUploadSysCd();
				}
			}
			view.addObject("tabNm",tabNm);
			view.addObject("cfgCd",cfgCd);
			view.addObject("cfgOrgCd",cfgOrgCd);
			view.addObject("cfgSysCd",cfgSysCd);
			view.addObject("modulePath",modulePath);
			view.addObject("costomerPath",costomerPath);
			view.addObject("rootPath",rootPath);
			view.addObject("uploadSysCd",uploadSysCd);

			if(StringUtils.isNotEmpty(splId)){
                SysUlFilesRecQueryCondition recQueryCondition = new SysUlFilesRecQueryCondition();
                recQueryCondition.setPkId(splId);
                recQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
                recQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                List<SysUlFilesRecDTO> allSysUlFilesRecDTOS = this.uploadApiService.searchSysUlFilesRecList(recQueryCondition);
                if(CollectionUtils.isEmpty(allSysUlFilesRecDTOS)){
                    view.addObject("isMatchFileRec","1");
                }else{
					view.addObject("isMatchFileRec","1");
                    for(SysUlFilesRecDTO dto : allSysUlFilesRecDTOS){
                    	if(!cfgCd.equals(dto.getCfgCd())){
							view.addObject("isMatchFileRec","0");
							break;
						}
					}
                }
            }else{
                view.addObject("isMatchFileRec","1");
            }


/*			List<String> cfgCdList = new ArrayList<>(4);
			cfgCdList.add(cfgCd);
			qc.setCfgCdList(cfgCdList);
			qc.setSysCd(SplSystemConstant.SPL_SYS_CD);
			qc.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
			qc.setIsValid(BaseConstant.IS_YESNO_YES);
			//附件配置文件信息
			List<SysUlDatCfgVO> sysUlDatCfgVOList = this.sysUlDatCfgService.searchList(qc);

			//<CFG_CD,CFG_NM>
			JSONObject jsonObject = null ;
			//附件配置明细List
			List<SysUlDatCfgDtlVO> sysUlDatCfgDtlVOList = null ;
			com.alibaba.fastjson.JSONArray jsonArray = null ;
			if(CollectionUtils.isNotEmpty(sysUlDatCfgVOList)){
				jsonArray  = new com.alibaba.fastjson.JSONArray(sysUlDatCfgVOList.size());
				SysUlFilesRecQueryCondition ulFileQc = null ;
				List<SysUlFilesRecVO> fileList = null ;
				for(SysUlDatCfgVO cfgVO : sysUlDatCfgVOList){
					jsonObject = new JSONObject();
					sysUlDatCfgDtlVOList = cfgVO.getSysUlDatCfgDtlVOList();
					jsonObject.put("cfgNm",cfgVO.getCfgNm());
					jsonObject.put("cfgCd",cfgVO.getCfgCd());
					jsonObject.put("sysCd",cfgVO.getSysCd());
					com.alibaba.fastjson.JSONArray cfgDtlCdRecVos = null ;
					if(null != sysUlDatCfgDtlVOList){
						cfgDtlCdRecVos = new com.alibaba.fastjson.JSONArray(sysUlDatCfgDtlVOList.size());
						for(SysUlDatCfgDtlVO cfgDtlVO : sysUlDatCfgDtlVOList){
							JSONObject dataObject = new JSONObject();
							dataObject.put("cfgDtlCd",cfgDtlVO.getCfgDtlCd());
							dataObject.put("cfgDtlCdNm",cfgDtlVO.getDatNm());
							if(StringUtils.isNotEmpty(splId)){
								ulFileQc = new SysUlFilesRecQueryCondition();
								ulFileQc.setCfgCd(cfgDtlVO.getCfgCd());
								ulFileQc.setSysCd(cfgDtlVO.getSysCd());
								ulFileQc.setOrgCd(cfgDtlVO.getOrgCd());
								ulFileQc.setPkId(splId);
								ulFileQc.setCfgDtlCd(cfgDtlVO.getCfgDtlCd());
								ulFileQc.setTabNm(SplInfoFileCfgEnum.getEnumByCode(cfgCd).getTableNm());
								fileList = this.sysUlFilesRecService.searchList(ulFileQc);
							}else{
								fileList = new ArrayList<>(1);
								SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
								filesRecVO.setCfgCd(cfgDtlVO.getCfgCd());
								filesRecVO.setSysCd(cfgDtlVO.getSysCd());
								filesRecVO.setOrgCd(cfgDtlVO.getOrgCd());
								filesRecVO.setCfgDtlCd(cfgDtlVO.getCfgDtlCd());
								filesRecVO.setDatNm(SplInfoFileCfgEnum.getEnumByCode(cfgCd).getTableNm());
								fileList.add(filesRecVO);
							}
							dataObject.put("fileRecVos",fileList);
							cfgDtlCdRecVos.add(dataObject);
						}
						jsonObject.put("data",cfgDtlCdRecVos);
					}
					jsonArray.add(jsonObject);
				}
				view.addObject("fileDtlList",jsonArray);
			}*/
		}
		String serverPath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		view.addObject("defImg", serverPath + customerPah + headPic);
		BaseLogUtils.newWebLogger("跳转到供应商资料新增页面.splId:" + splId).setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		return view;
	}

	/**
	 * 初始化经销商资料列表 2
	 */
	@RequestMapping(value = "/initSplFileInfoList.do", method = {RequestMethod.GET})
	@ResponseBody
	public Object initSplFileInfoList(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");//客户ID
		String cfgCd = request.getParameter("cfgCd");//附件配置编号
		String tabNm = request.getParameter("tabNm");//附件对应表名
		String cfgOrgCd = request.getParameter("cfgOrgCd") ;
		String cfgSysCd = request.getParameter("cfgSysCd") ;
		SysUlFilesRecQueryCondition qc = new SysUlFilesRecQueryCondition();
		qc.setPkId(splId);
		qc.setCfgCd(cfgCd);
		if(StringUtils.isNotEmpty(cfgSysCd)){
			qc.setSysCd(cfgSysCd);
		}else{
			qc.setSysCd(SplSystemConstant.SPL_SYS_CD);
		}
		if(StringUtils.isNotEmpty(cfgOrgCd)){
			qc.setOrgCd(cfgOrgCd);
		}else{
			qc.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
		}
		if(StringUtils.isNotEmpty(tabNm)){
			qc.setTabNm(tabNm);
		}
		qc.setIsDel(BaseConstant.IS_YESNO_NO);
		List<PrjFileInfoVO> list = this.getUploadFileList(qc);
		ListPageVO listPageVO = null ;
		if (CollectionUtils.isNotEmpty(list)) {
			listPageVO =  new ListPageVO<PrjFileInfoVO>(list, list.size());
		}else{
			listPageVO =  new ListPageVO<PrjFileInfoVO>(new ArrayList<PrjFileInfoVO>(), 0);
		}
		BaseLogUtils.newWebLogger("数据DATA:"+JSON.toJSONString(listPageVO)).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		return listPageVO ;
	}

	private List<PrjFileInfoVO> getUploadFileList(SysUlFilesRecQueryCondition condition) throws BaseException {
		//查询资料配置，系统代码,组织架构代码,配置编号 ,业务主键
		SysUlDatCfgQueryCondition ulDatCfgQueryCondition = new SysUlDatCfgQueryCondition();
		ulDatCfgQueryCondition.setSysCd(condition.getSysCd());//系统代码
		ulDatCfgQueryCondition.setOrgCd(condition.getOrgCd());
		ulDatCfgQueryCondition.setDataId(String.valueOf(condition.getPkId()));//业务主键
		ulDatCfgQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
		List<String> cfgCdList = new ArrayList<>();
		cfgCdList.add(condition.getCfgCd());//配置编号
		ulDatCfgQueryCondition.setCfgCdList(cfgCdList);//配置编号集合
		List<SysUlDatCfgDTO> list = this.uploadApiService.searchSysUlDatCfgListByDataId(ulDatCfgQueryCondition);

		List<PrjFileInfoVO> voList = null;
		if (CollectionUtils.isNotEmpty(list)) {
			Map<String, String> audStsCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), CapitalConstant.CODE_MATE_AUD_STS_CD);
			voList = new ArrayList<>();
			PrjFileInfoVO vo;
			//设置路径
			String picServicePath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
			for (SysUlDatCfgDTO dto : list) {
				for (SysUlDatCfgDtlDTO dtlDTO : dto.getSysUlDatCfgDtlDTOList()) {
					vo = new PrjFileInfoVO();
					vo.setId(Long.valueOf(condition.getPkId()));//业务主键
					vo.setCfgDtlCd(dtlDTO.getCfgDtlCd());//配置子编号
					vo.setDatNm(dtlDTO.getDatNm());//配置名称
					vo.setCfgCd(dtlDTO.getCfgCd());//配置编号
					vo.setOrgCd(dtlDTO.getOrgCd());//配置组织架构代码
					vo.setCfgNm(dto.getCfgNm());//配置子名称
					vo.setFileId(dtlDTO.getRecId());//附件ID
					//如果有HTTP开头说明是可以访问路径,无需干涉
					if(StringUtils.isNotBlank(dtlDTO.getFilePath()) && !dtlDTO.getFilePath().startsWith("http") && StringUtils.isNotBlank(picServicePath)){
						vo.setFilePath(picServicePath+dtlDTO.getFilePath());
					}else{
						vo.setFilePath(dtlDTO.getFilePath());
					}
					vo.setFileNm(dtlDTO.getRecFileNm());//上传名称
					vo.setCrtTm(dtlDTO.getRecCrtTm());//上传时间
					vo.setIsMust(dtlDTO.getIsMust());//是否必传
					if (StringUtils.isNotBlank(dtlDTO.getRecAudStsCd())) {
						vo.setAudStsCd(dtlDTO.getRecAudStsCd());//验证状态
					} else {
						vo.setAudStsCd("0");//验证状态
					}

					if (audStsCdMap != null && audStsCdMap.containsKey(vo.getAudStsCd())) {
						vo.setAudStsCdNm(audStsCdMap.get(vo.getAudStsCd()));
					}
					voList.add(vo);
				}
			}
		}
		return voList;
	}


	/*
	 * 到添加照片表页面
	 */
	/*@RequestMapping(value = "/addInvestImgPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView addPrjPrdImgPage(HttpServletRequest request, HttpServletResponse response) {
		logger.info("到添加照片列表页面.");
		String dtlId = request.getParameter("id");// 供应商id
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");// 子代码
		ModelAndView view = new ModelAndView("product/splInfo/addInvestImgPage");
		view.addObject("pkId", dtlId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", SplInfoFileCfgEnum.getEnumByCode(cfgCd).getOrgCd());
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("tabNm",SplInfoFileCfgEnum.getEnumByCode(cfgCd).getTableNm());
		view.addObject("rootPath",SplInfoFileCfgEnum.getEnumByCode(cfgCd).getUploadRootPath());
		view.addObject("costomerPath",SplInfoFileCfgEnum.getEnumByCode(cfgCd).getUploadCostomerPath());
		view.addObject("uploadSysCd",SplInfoFileCfgEnum.getEnumByCode(cfgCd).getUploadSysCd());
		view.addObject("modulePath",SplInfoFileCfgEnum.getEnumByCode(cfgCd).getModulePath());
		return view;
	}
*/
	/**
	 * 上传图片
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/addProjectPhoto.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addProjectPhoto(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		String prjId = request.getParameter("prjId");
		String fileNm = request.getParameter("fileNm");
		String filePath = request.getParameter("filePath");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		Long id = null;
		try {
			SysUlFilesRecVO fileRec = new SysUlFilesRecVO();
			if (StringUtils.isNotBlank(prjId)) {
				fileRec.setPkId(prjId);
			}
			SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
			fileQc.setCfgCd(cfgCd);
			fileQc.setPkId(prjId);
			fileQc.setTabNm(SplInfoFileCfgEnum.getEnumByCode(cfgCd).getTableNm());
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(sysCd);
			fileQc.setCfgDtlCd(cfgDtlCd);
			this.sysUlFilesRecService.removeByCondition(fileQc);
			fileRec.setFileNm(fileNm);
			fileRec.setFilePath(filePath);
			fileRec.setSysCd(sysCd);
			fileRec.setOrgCd(orgCd);
			fileRec.setCfgCd(cfgCd);
			fileRec.setCfgDtlCd(cfgDtlCd);
			fileRec.setTabNm(SplInfoFileCfgEnum.getEnumByCode(cfgCd).getTableNm());
			fileRec.setCrtTm(new Date());
			fileRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setMdfTm(new Date());
			fileRec.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setIsDel(BaseConstant.IS_YESNO_NO);
			id = this.sysUlFilesRecService.add(fileRec);
			//id = this.splBscInfoService.addFileRecList(fileQc, fileRec);
			// 查询保存成功的数据
			SysUlFilesRecVO filesRecVO = this.sysUlFilesRecService.selectById(id);
			result.setData(filesRecVO);
			BaseLogUtils.newWebLogger("新增数据.[id=" + id + "] DATA:" + JSONObject.toJSONString(filesRecVO)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();

		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}

	/**
	 * 删除项目资料
	 *
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/removeFile.do", method = {RequestMethod.POST})
	@ResponseBody
	public DataResultVO removeFile(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		String fileId = request.getParameter("fileId");
		if (StringUtils.isEmpty(fileId)) {
			BaseLogUtils.newWebLogger("删除附件信息==>附件ID为空").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
			return result;
		}
		List<Long> idList = new ArrayList<>(1);
		idList.add(Long.valueOf(fileId));
		boolean success = sysUlFilesRecService.removeByIds(idList);
		BaseLogUtils.newWebLogger("删除附件信息,id=" + fileId + ",success=" + success).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		if (!success) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
		}
		return result;
	}

	/**
	 * 修改项目资料的验证状态
	 *
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/modifyFileAudStsCd.do", method = {RequestMethod.POST})
	@ResponseBody
	public DataResultVO modifyFileAudStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String fileId = request.getParameter("fileId");
		String audStsCd = request.getParameter("audStsCd");
		if (StringUtils.isEmpty(fileId)) {
			BaseLogUtils.newWebLogger("修改经销商资料的验证状态==>资料ID为空").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("验证操作失败");
			return result;
		}
		if (StringUtils.isBlank(audStsCd)) {
			BaseLogUtils.newWebLogger("修改经销商资料的验证状态==>验证状态为空").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);

			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("验证操作失败");
			return result;
		}
		boolean success = this.uploadApiService.modifySysUlFilesRecAudStsCdById(Long.valueOf(fileId), audStsCd);
		BaseLogUtils.newWebLogger("修改经销商资料的验证状态,id=" + fileId + ",audStsCd=" + audStsCd + ",success=" + success).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		if (!success) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("验证操作失败");
		}
		return result;
	}

	/**
	 *供应商资料新增
	 * @param request
	 * @param response
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/addSplFileList.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addSplFileList(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		List<SysUlFilesRecVO> fileList = new ArrayList<SysUlFilesRecVO>();
		try {
			fileList = this.getFileList(request);
			if(CollectionUtils.isEmpty(fileList)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("没有要保存的资料.");
				BaseLogUtils.newWebLogger("新增供应商资料失败,没有要保存的资料").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.warn(LogExceptionEnum.COMMON_CODE_0001);
				return result;
			}
			String fileId = request.getParameter("fileId");
			if(StringUtils.isNotEmpty(fileId)){
				//先删除
				//this.uploadApiService.updateSysUlFilesRecByQC(null);
			}
			boolean success = this.prdSplInfoService.batchAddFileList(fileList);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_ADD_FAIL);
				BaseLogUtils.newWebLogger("新增供应商资料失败,DATA:"+JSON.toJSONString(fileList)).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
				return result;
			}else{
				result.setSuccess(BaseConstant.IS_YESNO_YES);
				result.setInfo(SysLogConstant.LOG_CMM_ADD_SUCC);
				BaseLogUtils.newWebLogger("新增供应商资料成功,DATA:"+JSON.toJSONString(fileList)).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.info();
				return result;
			}
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增供应商资料失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增供应商资料失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}

		return result;
	}

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toSplLimRateDetailPage.do", method = { RequestMethod.GET})
	public ModelAndView toSplLimRateDetailPage(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");

		ModelAndView view = new ModelAndView("spl/splInfo/splLimRateDetail");
		view.addObject("splId", splId);

		return view;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/getSplLimRateListBySplId.do", method = { RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Object getSplLimRateListBySplId(HttpServletRequest request, HttpServletResponse response) {
		try {
			String currentPage = request.getParameter("page");
			String pageSize = request.getParameter("pagesize");
			String splId = request.getParameter("splId");

			Pager page = new Pager();
			if (StringUtils.isNotEmpty(currentPage)) {
				page.setCurrentPage(Integer.parseInt(currentPage));
			}

			if (StringUtils.isNotEmpty(currentPage)) {
				page.setEveryPage(Integer.parseInt(pageSize));
			}

			SplLimRateQC qc = new SplLimRateQC();
			qc.setIsDel(BaseConstant.IS_YESNO_NO);
			qc.setDataId(Long.parseLong(splId));
			qc.setTabNm(SplInfoConstant.PRD_SPL_TAB_NAME);

			page.setCondition(qc);
			BaseLogUtils.newWebLogger("初始化周转化率列表页面数据.DATA:"+JSONObject.toJSONString(page)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			Pager pager = this.prdSplInfoService.searchSplLimRateListPage(page);

			BaseLogUtils.newWebLogger("获取周转化率列表页面数据.DATA:"+JSONObject.toJSONString(pager)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			List<SplLimRateVO> list = null;
			if (null != pager) {
				list = (List<SplLimRateVO>) pager.getResultList();
			} else {
				list = new ArrayList<>();
			}

			BaseLogUtils.newWebLogger("返回页面数据.DATA:"+JSONObject.toJSONString(list)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			ListPageVO<SplLimRateVO> listPage = new ListPageVO<>(list, null != pager ? pager.getTotalCount() : 0);
			return listPage;
		} catch (BaseException e) {
			BaseLogUtils.newWebLogger("初始化周转化率列表页面失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
			e.printStackTrace();
		} catch (Exception e) {
			BaseLogUtils.newWebLogger("初始化周转化率列表页面失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			e.printStackTrace();
		}
		return null;
	}

	//********************私有方法********************//

	/**
	 * 获取供应商资料信息
	 * @param request
	 * @return
	 * @throws BaseException
	 */
	private List<SysUlFilesRecVO> getFileList(HttpServletRequest request)throws BaseException{
		String splId = request.getParameter("splId");
		if(StringUtils.isEmpty(splId)){
			throw new BaseException(BaseExceptionConstant.COMMON_0001, "供应商ID不能为空!");
		}
		String fileParams = request.getParameter("fileParams");//附件上传信息
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd  =request.getParameter("cfgDtlCd");
		String orgCd = request.getParameter("orgCd");
		String cfgSysCd = request.getParameter("cfgSysCd");
		String rootPath = request.getParameter("rootPath");
		String tabNm = request.getParameter("tabNm");
		List<SysUlFilesRecVO> sysUlFilesRecVOList = new ArrayList<SysUlFilesRecVO>();
		//解析附件上传信息
		if(StringUtils.isNotEmpty(fileParams)){
			List<Map<String, String>> fileParamsList = new ArrayList<Map<String, String>>();
			JSONArray arry = JSONArray.fromObject(fileParams);
			if(!(arry.size()>0)){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "没有要保存的资料信息");
			}
			for (int i = 0; i < arry.size(); i++) {
				net.sf.json.JSONObject jsonObject = arry.getJSONObject(i);
				Iterator<?> it = jsonObject.keys();
				HashMap<String, String> hMap = new HashMap<String, String>();
				while (it.hasNext())
				{
					String key = String.valueOf(it.next());
					String value = (String) jsonObject.get(key);
					hMap.put(key, value);
				}
				fileParamsList.add(hMap);
			}
			for (Map<String, String> map : fileParamsList) {
				SysUlFilesRecVO sysUlFilesRecVO = new SysUlFilesRecVO();
				sysUlFilesRecVO.setFileNm(map.get("fileNm"));
				sysUlFilesRecVO.setFilePath(map.get("filePath"));
				if(StringUtils.isNotEmpty(rootPath)){
					sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(rootPath)+map.get("filePath"));
				}else{
					sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH)+map.get("filePath"));
				}
				sysUlFilesRecVO.setCrtTm(new Date());
				sysUlFilesRecVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				sysUlFilesRecVO.setPkId(splId);
				//TODO 这里应该先读配置  按配置保存   这里先写死后期再改---------------Start
				if(StringUtils.isNotEmpty(cfgSysCd)){
					sysUlFilesRecVO.setSysCd(cfgSysCd);
				}else{
					sysUlFilesRecVO.setSysCd(CurrentThreadContext.getCurrentSysCd());
				}
				if(StringUtils.isNotEmpty(orgCd)){
					sysUlFilesRecVO.setOrgCd(orgCd);
				}else{
					sysUlFilesRecVO.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
				}
				if(StringUtils.isNotEmpty(cfgCd)){
					sysUlFilesRecVO.setCfgCd(cfgCd);
				}else{
					sysUlFilesRecVO.setCfgCd(SplInfoConstant.SPL_INFO_FILE_UPLOAD_CFG_CD);
				}
				if(StringUtils.isNotEmpty(cfgDtlCd)){
					sysUlFilesRecVO.setCfgDtlCd(cfgDtlCd);
				}else{
					sysUlFilesRecVO.setCfgDtlCd(SplInfoConstant.SPL_INFO_FILE_UPLOAD_CFG_DTL_CD);
				}
				//TODO---------------------------------------------------------End
				//默认验证状态:未验证
				sysUlFilesRecVO.setAudStsCd(PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.DictionaryConstant.CODE_GRP_VALID_STATUS_CD_A));
				if(StringUtils.isNotEmpty(tabNm)){
					sysUlFilesRecVO.setTabNm(tabNm);
				}else{
					sysUlFilesRecVO.setTabNm(SplInfoConstant.PRD_SPL_TAB_NAME);
				}
				sysUlFilesRecVO.setIsDel(BaseConstant.IS_YESNO_NO);
				sysUlFilesRecVOList.add(sysUlFilesRecVO);
			}
		}else{
			throw new BaseException(BaseExceptionConstant.COMMON_0001, "保存供应商资料信息,没有要保存的资料.");
		}
		return sysUlFilesRecVOList;
	}
	/**
	 * 获取供应商参数信息
	 * @param request
	 * @return
	 * @throws BaseException
	 */
	private SplInfoVO getRequestParamForPrdSpl(HttpServletRequest request)throws BaseException{
		String mfrIds = request.getParameter("mfrIds");//所属厂商
		List<Long> mfrIdsList = new ArrayList<Long>();
		if(StringUtils.isNotBlank(mfrIds)){
			String[] mfrIdsStr = mfrIds.split(";");
			if(mfrIdsStr.length>0){
				for (String str : mfrIdsStr) {
					mfrIdsList.add(Long.valueOf(str));
				}
			}
		}
		String rebPct = request.getParameter("rebPct") ;//供应商返利比例
		String splNm = request.getParameter("splNm");//供应商名称
		String taxRegNo = request.getParameter("taxRegNo");//税务登记号
		String splTel = request.getParameter("splTel");//联系方式
		String splFax = request.getParameter("splFax");//供应商传真
		String corpTypCd = request.getParameter("corpTypCd");//企业性质
		String bizLicNo = request.getParameter("bizLicNo");//营业执照注册号
		String regDt = request.getParameter("regDt");//成立日期
		String expDt = request.getParameter("expDt");//有效日期
		String orgCode = request.getParameter("orgCode");//组织机构代码号  taxRegNo
		String regCapAmt = request.getParameter("regCapAmt");//注册资本
		String regCapUntCd = request.getParameter("regCapUntCd");//注册资本单位
		String paidCapAmt = request.getParameter("paidCapAmt");//实收资本
		String paidCapUntCd = request.getParameter("paidCapUntCd");//实收资本单位
		String isBuyBack = request.getParameter("isBuyBack");//是否回购
		String regAddr = request.getParameter("regAddr");//注册地址
		String rgnPrCd = request.getParameter("rgnPrCd");//区域 省CD
		String rgnCyCd = request.getParameter("rgnCyCd");//区域 市CD
		String postAddr = request.getParameter("postAddr");//供销商地址
		String websit = request.getParameter("websit");//供销商网址
		String bizScope = request.getParameter("bizScope");//经营范围
		String othInfoCd = request.getParameter("othInfoCd");//其他信息
		String zipNo = request.getParameter("zipNo");//其他信息

		String splLvlCd = request.getParameter("splLvlCd");//供应商级别
		String bilWayCd = request.getParameter("bilWayCd");//开票资质
		String prjLvlCd = request.getParameter("prjLvlCd");//供应商立项级别

		String splAttrCd = request.getParameter("splAttrCd");//供应商属性
		String atcId = request.getParameter("atcId");

		String splDoorNm = request.getParameter("splDoorNm"); //供应商门头名称
		String splCstTypCd = request.getParameter("splCstTypCd"); //供应商客户类型 SPL0030

		String tkBrCd = request.getParameter("tkBrCd");//卡车品牌

		// JIANGZG 2018-8-3 14:17:42 add
		String buOrgCdList = request.getParameter("buOrgCds"); //所属事业部CODE List
		String chkBusTypList = request.getParameter("chkBusTypList"); //查征信业务CODE List

		String newCarTyp = request.getParameter("newCarTyp");
		String usedCarTyp = request.getParameter("usedCarTyp");

		String succ = request.getParameter("succ");

		String ownerCd = request.getParameter("ownerCd");//公司归属

		List<String> tkBrCdList = new ArrayList<String>();


		if(StringUtils.isNotEmpty(tkBrCd)){
			String[] brCdsStr = tkBrCd.split(";");
			if(brCdsStr.length>0){
				for (String str : brCdsStr) {
					tkBrCdList.add(str);
				}
			}
		}

		String carBrCd = request.getParameter("carBrCd");//乘用车品牌
		List<String> carBrCdList = new ArrayList<String>();
		if(StringUtils.isNotEmpty(carBrCd)){
			String[] brCdsStr = carBrCd.split(";");
			if(brCdsStr.length>0){
				for (String str : brCdsStr) {
					carBrCdList.add(str);
				}
			}
		}
		String busBrCd = request.getParameter("busBrCd");//客车品牌
		List<String> busBrCdList = new ArrayList<String>();
		if(StringUtils.isNotEmpty(busBrCd)){
			String[] brCdsStr = busBrCd.split(";");
			if(brCdsStr.length>0){
				for (String str : brCdsStr) {
					busBrCdList.add(str);
				}
			}
		}

		String prjTypCds = request.getParameter("prjTypCds");//项目类型
		List<String> prjTypCdsList = null ;
		if(StringUtils.isNotEmpty(prjTypCds)){
			String[] prjTypCdsStr = prjTypCds.split(";");
			if(prjTypCdsStr.length>0){
				prjTypCdsList = new ArrayList<String>(prjTypCdsStr.length);
				for (String str : prjTypCdsStr) {
					prjTypCdsList.add(str);
				}
			}
		}
		SplInfoVO prdSplInfoVO = new SplInfoVO();

		if(StringUtils.isNotBlank(atcId)){
			prdSplInfoVO.setAtcId(Long.valueOf(atcId));
		}

		// 2018-4-24 18:36:22 add jiangzg CRM新增字段
		if(StringUtils.isNotEmpty(splDoorNm)){
			prdSplInfoVO.setSplDoorNm(splDoorNm);
		}

		if(StringUtils.isNotEmpty(splCstTypCd)){
			prdSplInfoVO.setSplCstTypCd(Integer.valueOf(splCstTypCd));
		}else{
			prdSplInfoVO.setSplCstTypCd(SplCstTypCdEnum.INTENTION_CST.getStatus());
		}

		String splTypCd = request.getParameter("splTypCd");
		if(StringUtils.isNotBlank(splTypCd)){
			prdSplInfoVO.setSplTypCd(splTypCd);
			if("1".equalsIgnoreCase(splTypCd)){
				String agtSec = request.getParameter("agtSec");
				String agtThd = request.getParameter("agtThd");
				String bscTaskQty = request.getParameter("bscTaskQty");
				String entDepAmt = request.getParameter("entDepAmt");
				String prdMaxValAmt = request.getParameter("prdMaxValAmt");
				if(StringUtils.isNotBlank(agtSec)){
					prdSplInfoVO.setAgtSec(agtSec);
				}
				if(StringUtils.isNotBlank(agtThd)){
					prdSplInfoVO.setAgtThd(agtThd);
				}
				if(StringUtils.isNotBlank(bscTaskQty)){
					prdSplInfoVO.setBscTaskQty(Integer.valueOf(bscTaskQty));
				}
				if(StringUtils.isNotBlank(entDepAmt)){
					prdSplInfoVO.setEntDepAmt(Double.valueOf(entDepAmt.trim()));
				}
				if(StringUtils.isNotBlank(prdMaxValAmt)){
					prdSplInfoVO.setPrdMaxValAmt(Double.valueOf(prdMaxValAmt.trim()));
				}
			}else{
				prdSplInfoVO.setAgtSec("");
				prdSplInfoVO.setAgtThd("");
				prdSplInfoVO.setBscTaskQty(0);
				prdSplInfoVO.setEntDepAmt(0d);
				prdSplInfoVO.setPrdMaxValAmt(0d);
			}
		}
		String coopDt = request.getParameter("coopDt");
		if (StringUtils.isNotEmpty(coopDt)) {
			prdSplInfoVO.setCoopDt(DateUtils.formatStringToDate(coopDt, DateUtils.YYYY_MM_DD));
		}
		//增加供应商属性判断
		if(StringUtils.isNotEmpty(splAttrCd) && CustomerConstant.CST_TYP_CD_NP.equals(splAttrCd)){
			if (StringUtils.isBlank(splNm)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "姓名不能为空!");
			}
			if (StringUtils.isBlank(bizLicNo)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "证件号不能为空!");
			}

			if (StringUtils.isNotEmpty(splTel) && !StringUtils.isMobilePhoneAndFixedPhone(splTel)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "请输入正确的电话号码!");
			}

		}else{
			if (StringUtils.isBlank(splNm)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "供应商名称不能为空!");
			}
			/*if (StringUtils.isBlank(bizLicNo)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "营业执照号不能为空!");
			}
			if (StringUtils.isBlank(taxRegNo)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "税务登记号不能为空!");
			}
			if (StringUtils.isBlank(orgCode)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "组织机构代码号不能为空!");
			}*/

			if (StringUtils.isNotEmpty(splTel) && !StringUtils.isMobilePhoneAndFixedPhone(splTel)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "请输入正确的电话号码!");
			}

			if (StringUtils.isBlank(regDt) || !DateUtils.isDate(regDt, DateUtils.YYYY_MM_DD)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "成立日期不能为空,并且为日期格式!");
			}

			if (DateUtils.formatStringToDate(regDt, DateUtils.YYYY_MM_DD).after(new Date())) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "成立日期不能大于当前日期!");
			}
			//2017-5-20 12:55:48 by jiangzg delete
			/*if(CollectionUtils.isEmpty(tkBrCdList) && CollectionUtils.isEmpty(carBrCdList) && CollectionUtils.isEmpty(busBrCdList)){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "至少维护一种类型品牌");
			}*/

			//判断经销商必填项
			/*if(StringUtils.isEmpty(splLvlCd)){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "供应商级别不能为空!");
			}*/
			// 2017-5-20 12:51:31 by jiangzg delete
			/*if(null!=bilWayCd){
				if(StringUtils.isBlank(bilWayCd)){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "开票资质不能为空!");
				}
			}*/
			if(bilWayCd == null || StringUtils.isEmpty(bilWayCd)){
				bilWayCd = "";
			}

			/*if(null!=prjLvlCd){
				if(StringUtils.isBlank(prjLvlCd)){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "立项级别不能为空!");
				}
			}*/

			//联系人姓名电话不能为空
			//必须维护实际控制人
			String npSocialRlGridJSON = request.getParameter("npSocialRlGridJSON");
			List<SplRlPsnVO> rlPsnList = new ArrayList<SplRlPsnVO>();
			if(null!=npSocialRlGridJSON){
				rlPsnList = JSON.parseArray(npSocialRlGridJSON, SplRlPsnVO.class);
				BaseLogUtils.newWebLogger("联系人信息："+JSON.toJSONString(rlPsnList)).setLogOperType(LogOperEnum.RESP)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.info();
			}
			if(CollectionUtils.isEmpty(rlPsnList)){
				//新能源事业部 联系人不必填
				if(!PropertiesCacheUtils.getProperty(SystemConstant.FL_BUS_XNY_ORG_CD).equals(CurrentThreadContext.getCurrentBuOrgCd())){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护主要人员信息.");
				}
			}else{
				// 校验联系人信息
				this.checkRlPsn(rlPsnList);

				//验证必填联系人是否填写start
            	//供应商联系人类型
				Map<String, SysDictionaryDTO> splRLTypCdMap = this.sysDictionaryApiService.
						searchGroupToObjMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),
								fl.spl.facade.framework.constant.DictionaryConstant.CODE_RL_TYP_CD);
				//必须维护联系人类型
				List<String> mustRlTypCdList = new ArrayList<String>();
				for (Entry<String, SysDictionaryDTO> entry : splRLTypCdMap.entrySet()) {
					if (BaseConstant.IS_YESNO_YES == entry.getValue().getIsSysDef()) {
						mustRlTypCdList.add(entry.getKey());
					}
				}
				//前端传回的联系人类型集合
				List<String> rlTypCdList = new ArrayList<String>();
				for (SplRlPsnVO splRlPsnVO : rlPsnList) {
					if (null != splRlPsnVO) {
						rlTypCdList.add(splRlPsnVO.getRlTypCd());
					}
				}
				for (String string : mustRlTypCdList) {
					if (!rlTypCdList.contains(string)) {
						throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护" + splRLTypCdMap.get(string).getCodeNm() + "信息。");
					}
				}
				//验证必填联系人是否填写end
			}
			if(CollectionUtils.isNotEmpty(rlPsnList)){
				for (SplRlPsnVO splRlPsnVO : rlPsnList) {
					if(StringUtils.isEmpty(splRlPsnVO.getIsDel())){
						splRlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
					}
					if(StringUtils.isEmpty(splRlPsnVO.getId())){
						splRlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
						splRlPsnVO.setCrtTm(new Date());
						splRlPsnVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
					}else{
						splRlPsnVO.setMdfTm(new Date());
						splRlPsnVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
					}
				}
			}
			BaseLogUtils.newWebLogger("联系人信息："+JSON.toJSONString(rlPsnList)).setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.info();
			int i = 0 ;
			for (SplRlPsnVO splRlPsnVO : rlPsnList) {
				splRlPsnVO.setBrPerVerify("2");
				splRlPsnVO.setPyPerVerify("2");
				splRlPsnVO.setTdPerVerify("2");
				splRlPsnVO.setBusInfoVerify("2");
				if("14".equals(splRlPsnVO.getRlTypCd())){
					i++ ;
				}
			}
			if(i > 1){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "代偿担保联系人唯一，不支持同时存多个！");
			}
			prdSplInfoVO.setRlPsnList(rlPsnList);
		}

		if(StringUtils.isNotEmpty(rebPct)){
			prdSplInfoVO.setRebPct(Double.valueOf(rebPct));
		}else{
			prdSplInfoVO.setRebPct(0d);
		}
		//商家APP 增加字段   by ZHAOYONG begin 20170829
		/*String isAuthCrdChk = request.getParameter("isAuthCrdChk") ;//是否有权查询征信（1：是，0：否）
		String limChkTms = request.getParameter("limChkTms");// 每日可查询征信次数
		if(StringUtils.isNotEmpty(isAuthCrdChk)){
			prdSplInfoVO.setIsAuthCrdChk(Integer.valueOf(isAuthCrdChk));
		}else{
			prdSplInfoVO.setIsAuthCrdChk(0);
		}
		if(StringUtils.isNotEmpty(limChkTms)){
			prdSplInfoVO.setLimChkTms(Integer.valueOf(limChkTms));
		}*//*else{
			throw new BaseException(BaseExceptionConstant.COMMON_0001, "每日可查询征信次数不能为空.");
		}*/
		//商家APP 增加字段   by ZHAOYONG end 20170829
		splNm = org.springframework.util.StringUtils.replace( splNm, "（", "(" );
		splNm = org.springframework.util.StringUtils.replace( splNm, "）", ")");

		prdSplInfoVO.setSplNm(splNm.trim());
		if(StringUtils.isNotEmpty(taxRegNo)){
			prdSplInfoVO.setTaxRegNo(taxRegNo.trim());
		}
		if(StringUtils.isNotEmpty(bizLicNo)){
			prdSplInfoVO.setBizLicNo(bizLicNo.trim());
		}
		if(StringUtils.isNotEmpty(orgCode)){
			prdSplInfoVO.setOrgCode(orgCode.trim());
		}
		prdSplInfoVO.setPostAddr(postAddr);
		prdSplInfoVO.setWebsit(websit);
		//prdSplInfoVO.setBizScope(bizScope);
		prdSplInfoVO.setOthInfoCd(othInfoCd);
		//prdSplInfoVO.setFileNo(fileNo);
		prdSplInfoVO.setMfrIds(mfrIdsList);//所属厂商
		prdSplInfoVO.setSplTel(splTel);
		prdSplInfoVO.setSplFax(splFax);
		prdSplInfoVO.setCorpTypCd(corpTypCd);
		if(StringUtils.isNotEmpty(regDt)){
			prdSplInfoVO.setRegDt(DateUtils.formatStringToDate(regDt, DateUtils.YYYY_MM_DD));
		}
		if(StringUtils.isNotEmpty(expDt)){
			prdSplInfoVO.setExpDt(DateUtils.formatStringToDate(expDt, DateUtils.YYYY_MM_DD));
		}

		if(StringUtils.isNotBlank(regCapAmt)){
			prdSplInfoVO.setRegCapAmt(Double.valueOf(regCapAmt.trim()));
		}
		prdSplInfoVO.setRegCapUntCd(regCapUntCd);
		if(StringUtils.isNotBlank(paidCapAmt)){
			prdSplInfoVO.setPaidCapAmt(Double.valueOf(paidCapAmt.trim()));
		}
		prdSplInfoVO.setPaidCapUntCd(paidCapUntCd);
		if(null!=isBuyBack){
			prdSplInfoVO.setIsBuyBack(Integer.valueOf(isBuyBack.trim()));
		}
		if(StringUtils.isNotEmpty(regAddr)){
			prdSplInfoVO.setRegAddr(regAddr.trim());
		}
		if(StringUtils.isNotEmpty(rgnPrCd)){
			prdSplInfoVO.setRgnPrCd(rgnPrCd.trim());
		}
		if(StringUtils.isNotEmpty(rgnCyCd)){
			prdSplInfoVO.setRgnCyCd(rgnCyCd.trim());
		}

		//TODO JIANGZG 2018-8-3 16:19:51 修改
		List<String> buOrgCds = new ArrayList<>() ;
		List<String> chkBusTypCds = null ;

		List<SysDictionaryDTO> searchGroup = this.sysDictionaryApiService.searchGroup(WebBaseConstant.SPL_SYS_CD, WebBaseConstant.SYS_P_ORG_CD,WebBaseConstant.SPL_PROP_CODE_GRP_CD );


		//供应商经营类型
		List<String> propTypCdList = new ArrayList<String>();
		if(StringUtils.isNotEmpty(newCarTyp)){
			String[] newCarTypCdStr = newCarTyp.split(";");
			if(newCarTypCdStr.length > 0){
				for (String newCar : newCarTypCdStr) {
					propTypCdList.add(newCar);
				}
			}
		}
		if(StringUtils.isNotEmpty(usedCarTyp)){
			String[] usedCarTypCdStr = usedCarTyp.split(";");
			if(usedCarTypCdStr.length > 0){
				for (String usedCar : usedCarTypCdStr) {
					propTypCdList.add(usedCar);
				}
			}
		}
		if(CollectionUtils.isNotEmpty(propTypCdList) ){
			for (String typCd : propTypCdList) {
				for (SysDictionaryDTO sysDictionaryDTO : searchGroup) {
					if(sysDictionaryDTO.getCode().equals(typCd)){
						if(buOrgCds.contains(sysDictionaryDTO.getCodeDesc())){
							continue ;
						}
						buOrgCds.add(sysDictionaryDTO.getCodeDesc());
					}
				}
			}
			/*//TODO 2017-8-2 by YAOXIURONG
			String currentBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			Map<String, String> buOrgCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_SYS_BU_ORG_CD);
			if(buOrgCdMap.containsKey(currentBuOrgCd) && !buOrgCds.contains(currentBuOrgCd)){
				buOrgCds.add(currentBuOrgCd);//在已有事业部基础上增加当前事业部
			}*/
		}


		/*if(StringUtils.isNotEmpty(chkBusTypList)){
			if(StringUtils.isNotEmpty(buOrgCdList)){
				String[] buOrgCdSplit = buOrgCdList.split(",");
				buOrgCds = new ArrayList(buOrgCdSplit.length);
				for (int i = 0; i < buOrgCdSplit.length; i++) {
					if(buOrgCds.contains(buOrgCdSplit[i])){
						continue;
					}
					buOrgCds.add(buOrgCdSplit[i]);
				}
			}
			if(StringUtils.isNotEmpty(chkBusTypList)){
				String[] chkBusTypSplit = chkBusTypList.split(",");
				chkBusTypCds = new ArrayList(chkBusTypSplit.length);
				for (int i = 0; i < chkBusTypSplit.length; i++) {
					if(chkBusTypCds.contains(chkBusTypSplit[i])){
						continue;
					}
					chkBusTypCds.add(chkBusTypSplit[i]);
				}
				prdSplInfoVO.setChkBusTypCdList(chkBusTypCds);
			}
		}else{
			//String buOrgCds = request.getParameter("buOrgCdList");//所属事业部
			buOrgCds = new ArrayList<String>();
			if(StringUtils.isNotEmpty(buOrgCdList)){
				String[] buOrgCdsStr = buOrgCdList.split(";");
				if(buOrgCdsStr.length>0){
					for (String str : buOrgCdsStr) {
						buOrgCds.add(str);
					}
				}
			}
			//TODO 2017-8-2 by YAOXIURONG
			String currentBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			Map<String, String> buOrgCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_SYS_BU_ORG_CD);
			if(buOrgCdMap.containsKey(currentBuOrgCd) && !buOrgCds.contains(currentBuOrgCd)){
				buOrgCds.add(currentBuOrgCd);//在已有事业部基础上增加当前事业部
			}
		}*/
		//经营范围
		if(StringUtils.isNotEmpty(bizScope)){
			ArrayList<String> bizScopeList = new ArrayList<>();
			String[] bizScopeCds = bizScope.split(";");
			for (String string : bizScopeCds) {
				bizScopeList.add(string);
			}
			prdSplInfoVO.setBizScopeCdList(bizScopeList);

		}

		prdSplInfoVO.setTkBrCdList(tkBrCdList);//卡车品牌
		prdSplInfoVO.setCarBrCdList(carBrCdList);//乘用车品牌
		prdSplInfoVO.setBusBrCdList(busBrCdList);//客车品牌
		if(CollectionUtils.isEmpty(buOrgCds)){
			buOrgCds.add(CurrentThreadContext.getCurrentBuOrgCd());
		}
		if(CollectionUtils.isNotEmpty(buOrgCds) && buOrgCds.size() > 0){
			prdSplInfoVO.setBuOrgCds(buOrgCds);//所属事业部
		}
		if(CollectionUtils.isNotEmpty(prjTypCdsList) && prjTypCdsList.size() > 0){
			prdSplInfoVO.setPrjTypCds(prjTypCdsList);//项目类型
		}
		prdSplInfoVO.setZipNo(zipNo);
		prdSplInfoVO.setSplLvlCd(splLvlCd);
		prdSplInfoVO.setPrjLvlCd(prjLvlCd);
		prdSplInfoVO.setBilWayCd(bilWayCd);

		prdSplInfoVO.setSplAttrCd(splAttrCd);//供应商属性

		prdSplInfoVO.setChkBusTypCdList(propTypCdList);

		prdSplInfoVO.setSucc(succ);//社会统一代码
		prdSplInfoVO.setOwnerCd(ownerCd);//公司归属

		//如果营业执照为空则将社会统一代码写入营业执照
		if(StringUtils.isEmpty(bizLicNo) && StringUtils.isNotEmpty(succ)){
			prdSplInfoVO.setBizLicNo(succ);
		}
		if(StringUtils.isEmpty(taxRegNo) && StringUtils.isNotEmpty(succ)){
			prdSplInfoVO.setTaxRegNo(succ);
		}
		if(StringUtils.isEmpty(orgCode) && StringUtils.isNotEmpty(succ)){
			prdSplInfoVO.setOrgCode(succ);
		}
		// taxRegNo  orgCode
		return prdSplInfoVO;
	}

	/**
	 * 获取供应商请求参数(新增)
	 * @param request 请求
	 * @return
	 */
	private SplInfoVO getRequestParamForPrdSplAdd(HttpServletRequest request)throws BaseException{
		SplInfoVO prdSplInfoVO = this.getRequestParamForPrdSpl(request);
		prdSplInfoVO.setCrtTm(new Date());
		prdSplInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		prdSplInfoVO.setLivSwitch(BaseConstant.IS_YESNO_NO);
		prdSplInfoVO.setCrdLoaSwitch(BaseConstant.IS_YESNO_NO);
		return prdSplInfoVO;
	}

	/**
	 * 获取供应商请求参数(修改)
	 * @param request 请求
	 * @return
	 */
	private SplInfoVO getRequestParamForPrdSplModify(HttpServletRequest request)throws BaseException{
		SplInfoVO prdSplInfoVO = this.getRequestParamForPrdSpl(request);
		prdSplInfoVO.setMdfTm(new Date());
		prdSplInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		return prdSplInfoVO;
	}

	/**
	 * 启动供应商准入流程
	 */
	@RequestMapping(value = "/addFlowStart.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object addFlowStart(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String procDefKey = request.getParameter("procDefKey");
		String procDefId = request.getParameter("procDefId");
		String procNo = request.getParameter("procNo");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newWebLogger(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY).setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			return result;
		}
		boolean checkBlack = this.splInfoQueryApiService.checkSplIsBlackListById(Long.valueOf(id),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),null);
		if(!checkBlack){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("供应商为黑名单，无法发起准入流程！");
			return result ;
		}
		if(this.splBscInfoApplyService.checkModifyStatus(Long.valueOf(id))){
			throw new BaseException(BaseExceptionConstant.COMMON_0002, "该供应商存在变更流程，请变更流程结束后再发起审核流程.");
		}
		FlowStartParamsDTO flowStartParamsDTO = new FlowStartParamsDTO();
		Map<String, Object> param = new HashMap<>();
		String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		if (StringUtils.isNotEmpty(currentOrgCd) && currentOrgCd.startsWith("00000001")) {
			SplPropInfoQueryCondition qc = new SplPropInfoQueryCondition();
			qc.setPropTypCd("006");
			qc.setIsDel(BaseConstant.IS_YESNO_NO);
			qc.setIsValid(BaseConstant.IS_YESNO_YES);
			qc.setSplId(Long.valueOf(id));

			List<SplPropInfoDTO> dtoList = this.splPropInfoApiService.getSplPropInfoList(qc);
			if (CollectionUtils.isNotEmpty(dtoList) && StringUtils.isNotEmpty(dtoList.get(0).getPropInfo())) {
				param.put("needSpepowCheck", 1);
			}
		}
		try {
			//修改供应商流程权限变更  fengzuoxiang  2019-06-14
			/*//校验 如果是重卡事业部 需校验
			String currentBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			if(PropertiesCacheUtils.getProperty(SystemConstant.FL_ZK_BU_ORG_CD).equals(currentBuOrgCd)){
				SysBizFlowRlQueryCondition qc = new SysBizFlowRlQueryCondition();
				qc.setDataId(Long.valueOf(id));
				qc.setTabNm("SPL_BSC_INFO");
				BaseLogUtils.info(logger, "addFlowStart", "===查询业务数据与流程权限关系表Start===splId:"+id+",qc:"+JSON.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
				List<SysBizFlowRlDTO> list = this.sysBizFlowRlApiService.searchList(qc);
				BaseLogUtils.info(logger, "addFlowStart", "===查询业务数据与流程权限关系表End===splId:"+id+",list:"+JSON.toJSONString(list), CurrentThreadContext.getCurrentUserName());

				if(CollectionUtils.isEmpty(list)){
					throw new BaseException(BaseExceptionConstant.COMMON_0002, "请维护供应商放款流程权限.");
				}
			}*/

			//流程定义Key和流程定义ID 如果是前端选择的则直接指定,如果不是则系统自动按照配置选择唯一一条记录,如果找不到会提示
			flowStartParamsDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);

			flowStartParamsDTO.setWordsInTheTable(SplInfoConstant.SPL_FLOW_S_H_SPL);
			//流程定义标识(必填)
			flowStartParamsDTO.setProcDefKey(procDefKey);
			//流程定义ID(必填)
			flowStartParamsDTO.setProcDefId(procDefId);
			//流程定义名称(自定义)
			flowStartParamsDTO.setProcNo(procNo);

			flowStartParamsDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			//业务数据主键(必填)
			flowStartParamsDTO.setBusinessKey(id);
			flowStartParamsDTO.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			flowStartParamsDTO.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
			flowStartParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
			flowStartParamsDTO.setInitiator(String.valueOf(CurrentThreadContext.getCurrentUserId()));
			flowStartParamsDTO.setInitiatorNm(CurrentThreadContext.getCurrentUserName());
			flowStartParamsDTO.setProcPriority(FlowConstant.FLOW_PRIORITY_EMERGENCY);//优先级,可以在界面定义
			//业务类型(必填)-用于区分操作表标识
			flowStartParamsDTO.setBusinessType(FlowConstant.FLOW_BUSINESS_TYP_SPL_BSC_INFO);//确认用不用
			//模块类型(流程业务分类): 针对直接启动流程的业务使用
			flowStartParamsDTO.setModelTyp(FlowConstant.FLOW_MODEL_TYP_SPL_ACCESS);//需要和流程配置中的模块类型匹配
			flowStartParamsDTO.setSearchDesc(CurrentThreadContext.getCurrentOrgDispNm()+"、供应商流程大字段参数未定!");

			flowStartParamsDTO.setStartParams(param);
			DataResultDTO dataResultDTO = this.prdSplInfoService.addSplAdmissionFlowStart(flowStartParamsDTO);
			if(dataResultDTO != null){
				if(dataResultDTO.getCode() != null && !dataResultDTO.getCode().equals(BaseExceptionConstant.BASE_EXCEPTION_CODE_200)){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
				}
			}

			/*if (dataResultDTO != null) {
				if (StringUtils.isNotEmpty(dataResultDTO.getCode()) && dataResultDTO.getCode().equals(BaseExceptionConstant.BASE_EXCEPTION_CODE_200)) {
					// 发起流程成功
			        String ip = InetAddress.getLocalHost().getHostAddress();
			        BaseLogUtils.info(logger, "", "获取IP==>" + ip);

		            this.splNpBscInfoService.checkCredit(Long.valueOf(id), ip);
				}
			}*/

			// 发起审核流程成功
			String reason = request.getParameter("reason");// 操作原因
			try {
				if (StringUtils.isNotEmpty(reason)) {
					Long add = this.splOpLogRecService.add(id, reason, SplRelLogOpTypCdNum.STARTFLOW.getOpTypCd(), SplRelLogBizTypCdNum.SPL.getBizTypCd());
				}
			} catch (BaseException e) {
				BaseLogUtils.newWebLogger("插入供应商操作记录失败,业务异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.setThrowable(e)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
			/*if(null != dataResultDTO.getInfo() && StringUtils.isNotEmpty(dataResultDTO.getInfo())){
				StringBuffer info = new StringBuffer();
				info.append(result.getInfo());
				info.append(SysLogConstant.LOG_FLOW_NEXT_TASK_OPERATOR);
				info.append(dataResultDTO.getInfo());//操作人
				result.setInfo(info.toString());
			}*/
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("启动供应商准入流程失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("启动供应商准入流程失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}
	/**
	 * 到供应商流程跟踪页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toSplFlowPage.do", method = { RequestMethod.GET})
	public ModelAndView toProjectFlowPage(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");
		ModelAndView view = new ModelAndView("product/splInfo/splFlowList");
		view.addObject("splId", splId);
		return view;
	}
	/**
	 * 初始化项目流程跟踪列表
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/initPorjectFlowList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initPorjectFlowList(HttpServletRequest request, HttpServletResponse response) {
		String splId = request.getParameter("splId");//供应商Id
		List<SplFlowSHVO> list = new ArrayList<SplFlowSHVO>();
		if(StringUtils.isNotEmpty(splId)){
			list = this.prdSplInfoService.searchSplFlowList(Long.valueOf(splId));
			for (SplFlowSHVO projectFlowSHVO : list) {
				if(StringUtils.isEmpty(projectFlowSHVO.getGrpFlag())){
					projectFlowSHVO.setGrpFlag("-");
				}
			}
			Collections.sort(list, new Comparator<SplFlowSHVO>(){
				public int compare(SplFlowSHVO o1, SplFlowSHVO o2) {
					if(o1.getGrpFlag().compareTo(o2.getGrpFlag())!=0){
						return o1.getGrpFlag().compareTo(o2.getGrpFlag());
					}
					return o1.getBusTyp().compareTo(o2.getBusTyp());
				}
			});
		}
		ListPageVO<SplFlowSHVO> listPage = new ListPageVO<SplFlowSHVO>(list, list.size());
		return listPage;
	}

	/**
	 * 通过姓名身份证号码验证信息是否正确
	 * @param cstNm
	 * @param certNo
	 * @return
	 * @throws BaseException
	 */
	private void validateIdCard(String typeNm,String cstNm,String certNo) throws BaseException {
		//验证身份证号格式
		this.checkVIDInfoItem(typeNm,cstNm,certNo);
		//调用第三方接口验证证件信息
		this.validCert(typeNm,cstNm, certNo, "身份证信息验证未通过!", "validateIdCard");
	}

	/**
	 * 检查主要人员重要信息项
	 * @param cstNm 姓名
	 * @param certNo 证件号码
	 */
	private void checkVIDInfoItem(String typeNm,String cstNm,String certNo) throws BaseException {
		String certTypCd = DictionaryConstant.CODE_CERT_TYP_CD_0;

		// 验证必填项及长度
		if (StringUtils.isBlank(cstNm) || cstNm.length() > 20 || !StringUtils.isCustomerName(cstNm)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001,  typeNm+"【"+certNo+"】"+PrjLnkCompConstant.LOG_VALID_NM);
		}

		if (StringUtils.isBlank(certNo)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001, typeNm+"【"+cstNm+"】"+ PrjLnkCompConstant.LOG_VALID_CERT_NO_EMPTY);
		}

		if (certTypCd.equals(DictionaryConstant.CODE_CERT_TYP_CD_0) && !StringUtils.isIdCardNumber(certNo)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001,  typeNm+"【"+cstNm+"】"+ PrjLnkCompConstant.LOG_VALID_CERT_NO_ERROR);
		}
	}

	/**
	 * 证件验证
	 * @param certNm 证件名称
	 * @param certNo 证件号码
	 */
	private void validCert(String typeNm,String certNm, String certNo, String errorDesc, String funName)  throws BaseException {
		CstValidCardInfoVO cstValidCardInfoVO = this.cstBscInfoService.validateCstCert(certNm, certNo);
		if(!cstValidCardInfoVO.getSuccess()){
			//第三方验证未通过
			String info = errorDesc+" certNm:" + certNm + " - certNo:" +certNo;
			throw new BaseException(BaseExceptionConstant.COMMON_0001, typeNm+"【"+certNm+"】"+ errorDesc);
		}
	}

	@RequestMapping(value = "/updateBlackList",method = RequestMethod.POST)
	@ResponseBody
	public DataResultVO updateBlackList( String id,String blackList, String reason){
		if(StringUtils.isBlank(id) || StringUtils.isBlank(blackList)){
			return null;
		}
		DataResultVO dataResultVO = new DataResultVO();
		dataResultVO.setSuccess(1);
		if("1".equals(blackList)){
			// 插入供应商操作记录
			try {
				if (StringUtils.isNotEmpty(reason)) {
					Long add = this.splOpLogRecService.add(id, reason, SplRelLogOpTypCdNum.ADDBLACK.getOpTypCd(), SplRelLogBizTypCdNum.SPL.getBizTypCd());
				}
			} catch (BaseException e) {
				BaseLogUtils.newWebLogger("插入供应商操作记录失败,业务异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.setThrowable(e)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
			dataResultVO.setInfo("已经加入黑名单");
		}else{
			// 插入供应商操作记录
			try {
				if (StringUtils.isNotEmpty(reason)) {
					Long add = this.splOpLogRecService.add(id, reason, SplRelLogOpTypCdNum.CANCELBLACK.getOpTypCd(), SplRelLogBizTypCdNum.SPL.getBizTypCd());
				}
			} catch (BaseException e) {
				BaseLogUtils.newWebLogger("插入供应商操作记录失败,业务异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
						.setWarning(false)
						.setThrowable(e)
						.warn(LogExceptionEnum.COMMON_CODE_0002);
			}
			dataResultVO.setInfo("移出黑名单成功");
		}
		// update
		this.prdSplInfoService.updateBlackList(id,blackList);
		return dataResultVO;
	}
	/**
	 *
	 */
	@RequestMapping(value = "/modifyProtocolById.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifyProtocolById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "操作成功");
		String protocolId = request.getParameter("protocolId");
		String flag = request.getParameter("operation");
		if(StringUtils.isEmpty(protocolId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("协议ID为空");
			return result ;
		}
		SplRenewProtocolRecQC condition = new SplRenewProtocolRecQC();
		condition.setId(Long.valueOf(protocolId));
		Map<String, String> mdfMap = new HashMap<>();
		if("stop".equals(flag)){
			mdfMap.put("isValid", "0");
		}else{
			mdfMap.put("effectiveTm", DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DD));
			mdfMap.put("isValid", "1");
		}
		mdfMap.put("mdfTm", DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DD));
		//mdfMap.put("mdfUsrId", CurrentThreadContext.getCurrentUserId().toString());
		boolean b = this.splRenewProtocolRecApiService.updateSplRePtlRecDTOByQC(condition , mdfMap);
		if(!b){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("操作失败");
			return result ;
		}
		return result ;
	}

	/**
	 * 获取高管及股东信息
	 */
	@RequestMapping(value = "/getHolderAndMgrperson.do", method = {RequestMethod.POST, RequestMethod.GET})
	@ResponseBody
	public Object getHolderAndMgrperson(HttpServletRequest request, HttpServletResponse response) throws BaseException{
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "查询成功");
		String seqNo = request.getParameter("seqNo");//序列号
		//String dataId = request.getParameter("dataId");//供应商（挂靠公司）ID
		String dataNm = request.getParameter("dataNm");//供应商（挂靠公司）名称
		String type = request.getParameter("type");//类型  2：供应商，3：挂靠公司

		if(StringUtils.isEmpty(dataNm)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整");
			return result ;
		}
		if(StringUtils.isEmpty(type)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("类型不能为空");
			return result ;
		}
		List<HsjPersonDTO> personList = this.hsjQueryService.searchPersonDTOListByName(dataNm);

		BaseLogUtils.newWebLogger("personList==>" + JSONObject.toJSONString(personList)).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		List<HsjShareHolderDTO> shareHolderList = this.hsjQueryService.searchShareHolderByName(dataNm);
		BaseLogUtils.newWebLogger("holderList==>" + JSONObject.toJSONString(shareHolderList)).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();
		if(CollectionUtils.isNotEmpty(shareHolderList) && shareHolderList.size() > 1){
			shareHolderList = shareHolderList.subList(0, 1);
		}
		//this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE_RL_TYP_CD);
		List<SysDictionaryDTO> searchGroup ;

		if ("2".equals(type)) {
			searchGroup = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(),
					CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_RL_TYP_CD);
		} else {
			searchGroup = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(),
					CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
		}
		HashMap<String, String> map = new HashMap<>();
		for (SysDictionaryDTO dto : searchGroup) {
			map.put(dto.getCodeNm(), dto.getCode());
		}

		if("2".equals(type)){
			List<SplRlPsnVO> rlPsnList = new ArrayList<>();
			SplRlPsnVO psnVO ;
			for (HsjPersonDTO personDTO : personList) {
				psnVO = new SplRlPsnVO();
				/*psnVO.setRlNm(vo.getUsername());
				psnVO.setRlTypCd(map.get(vo.getDutyinc()));
				psnVO.setRlTypCdNm(vo.getDutyinc());*/
				if(StringUtils.isNotEmpty(personDTO.getPosition()) && (
						"董事".equals(personDTO.getPosition())
						|| "总经理".equals(personDTO.getPosition())
						|| "监事".equals(personDTO.getPosition())
						||"法人代表".equals(personDTO.getPosition()))){
					psnVO.setRlNm(personDTO.getName());
					psnVO.setRlTypCd(map.get(personDTO.getPosition()));
					psnVO.setRlTypCdNm(personDTO.getPosition());
					psnVO.setHsjPsnId(personDTO.getPersonId());

					rlPsnList.add(psnVO);
				}
			}

			for (HsjShareHolderDTO shareHolderDTO : shareHolderList) {
				psnVO = new SplRlPsnVO();
				psnVO.setRlNm(shareHolderDTO.getShareholderName());
				psnVO.setRlTypCd("5");
				psnVO.setRlTypCdNm("股东");
				psnVO.setStockRatio(shareHolderDTO.getFundedRatio());
				if(StringUtils.isNotBlank(shareHolderDTO.getShareId())) {
					psnVO.setHsjPsnId(shareHolderDTO.getShareId());
				}else{
					psnVO.setHsjPsnId("1");
				}
				rlPsnList.add(psnVO);

			}

			result.setData(rlPsnList);
		}else {
			List<PrjLnkCompRlPsnVO> rlPsnList = new ArrayList<>();
			PrjLnkCompRlPsnVO rlPsnVO ;
			for (HsjPersonDTO personDTO : personList) {
				rlPsnVO = new PrjLnkCompRlPsnVO();
				if(StringUtils.isNotEmpty(personDTO.getPosition())
						&& ("董事".equals(personDTO.getPosition())
						|| "总经理".equals(personDTO.getPosition())
						|| "监事".equals(personDTO.getPosition()))
						||"法人代表".equals(personDTO.getPosition())){
					rlPsnVO.setRlNm(personDTO.getName());
					rlPsnVO.setRlTypCd(map.get(personDTO.getPosition()));
					rlPsnVO.setRlTypCdNm(personDTO.getPosition());
					rlPsnVO.setHsjPsnId(personDTO.getPersonId());
					rlPsnList.add(rlPsnVO);
				}
			}

			for (HsjShareHolderDTO shareHolderDTO : shareHolderList) {
				rlPsnVO = new PrjLnkCompRlPsnVO();
				rlPsnVO.setRlNm(shareHolderDTO.getShareholderName());
				rlPsnVO.setRlTypCd("3");
				rlPsnVO.setRlTypCdNm("股东");
				rlPsnVO.setStockRatio(shareHolderDTO.getFundedRatio());
				if(StringUtils.isNotBlank(shareHolderDTO.getShareId())) {
					rlPsnVO.setHsjPsnId(shareHolderDTO.getShareId());
				}else{
					rlPsnVO.setHsjPsnId("1");
				}
				rlPsnList.add(rlPsnVO);
			}

			result.setData(rlPsnList);
		}

		BaseLogUtils.newWebLogger("返回结果=>" + JSONObject.toJSONString(result)).setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.info();

		return result ;


	}

	private void checkRlPsn(List<SplRlPsnVO> list) throws BaseException{
		if(CollectionUtils.isEmpty(list)){
			return ;
		}

		Map<String, String>  certTypCdList = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE_RL_TYP_CD);

		for (SplRlPsnVO splRlPsnVO : list) {

			if(StringUtils.isEmpty(splRlPsnVO.getRlNm())){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, certTypCdList.get(splRlPsnVO.getRlTypCd())+"姓名不能为空.");
			}else if(StringUtils.isEmpty(splRlPsnVO.getRlTypCd())){
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "联系人类型不能为空.");
			}
			if(StringUtils.isNotEmpty(splRlPsnVO.getIsDefault()) && "1".equals(splRlPsnVO.getIsDefault().toString()) && (SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_1.equals(splRlPsnVO.getRlTypCd())
					)){

				//验证输入项是否为空
				if(StringUtils.isEmpty(splRlPsnVO.getTel())){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, certTypCdList.get(splRlPsnVO.getRlTypCd())+"电话不能为空.");
				}else if(StringUtils.isEmpty(splRlPsnVO.getCertTypCd())){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, certTypCdList.get(splRlPsnVO.getRlTypCd())+"证件类型不能为空.");
				}else if(StringUtils.isEmpty(splRlPsnVO.getCertNo())){
					throw new BaseException(BaseExceptionConstant.COMMON_0001, certTypCdList.get(splRlPsnVO.getRlTypCd())+"证件号码不能为空.");
				}
			}
		}
	}

	/**
	 * 到三方数据页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toThreeDataPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toThreeDataPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("spl/splInfo/splTripartiteDataTab");
		String splId = request.getParameter("splId");
		String saveBizFlowRl = request.getParameter("saveBizFlowRl");

		List<SysDictionaryDTO> splOpTypCds = this.sysDictionaryApiService.searchGroupAll(SplSystemConstant.SPL_SYS_CD,SplSystemConstant.DEFAULT_ORG_CD, fl.spl.facade.framework.constant.DictionaryConstant.SPL_OP_TYP_CD);
		List<KeyValueVO> opTypCd = null ;
		if(CollectionUtils.isNotEmpty(splOpTypCds)){
			opTypCd = new ArrayList<>(splOpTypCds.size());
			for(SysDictionaryDTO dto : splOpTypCds){
				if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
					KeyValueVO keyValueVO = new KeyValueVO();
					keyValueVO.setKey(dto.getCode());
					keyValueVO.setValue(dto.getCodeNm());
					opTypCd.add(keyValueVO);
				}
			}
		}
		view.addObject("opTypCd", JSON.toJSON(opTypCd));

		List<KeyValueVO> signDesc = this.sysDictionaryApiService.getKvList(fl.spl.facade.framework.constant.DictionaryConstant.SPL_SIGN_DESC_CD,SplSystemConstant.SPL_SYS_CD,SplSystemConstant.DEFAULT_ORG_CD);
		view.addObject("signDesc", JSON.toJSON(signDesc));

		view.addObject("splId", splId);

		String isFlow = request.getParameter("isFlow");//是否在流程页面中打开
		view.addObject("isFlow", isFlow);

		String isWarnCheck = request.getParameter("isWarnCheck");
		view.addObject("isWarnCheck", isWarnCheck);
		view.addObject("saveBizFlowRl", saveBizFlowRl);

		String warnRecId = request.getParameter("warnRecId");// 高风险预警记录ID
		view.addObject("warnRecId", warnRecId);

        String isRiskWarnFlow = request.getParameter("isRiskWarnFlow");//是否是供应商高风险复议流程审核节点
        if (StringUtils.isNotEmpty(isRiskWarnFlow)) {
            view.addObject("isRiskWarnFlow", isRiskWarnFlow);
        } else {
            view.addObject("isRiskWarnFlow", 0);
        }

		return view;
	}

	/**
	 * 到三方数据页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/saveLoa.do", method = { RequestMethod.GET, RequestMethod.POST })
	@ResponseBody
	public Object saveLoa(HttpServletRequest request, HttpServletResponse response) {
		String isRecycleLoa = request.getParameter("isRecycleLoa");
		String isUpLoadLoa = request.getParameter("isUploadLoa");
		String succ = request.getParameter("succ");
		String splId = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "修改成功！");
		if(StringUtils.isEmpty(splId)){
			result.setInfo("主键ID不能为空");
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			return result ;
		}
		SplInfoVO vo = new SplInfoVO();
		if(StringUtils.isNotEmpty(succ)){
			vo.setId(Long.valueOf(splId));
			vo.setSucc(succ);
		}else {
			if (StringUtils.isEmpty(isUpLoadLoa) && StringUtils.isEmpty(isRecycleLoa)) {
				result.setInfo("修改内容为空，修改失败");
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				return result;
			}
			if ("2".equals(isUpLoadLoa) && "2".equals(isRecycleLoa)) {
				result.setInfo("修改内容为空，修改失败");
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				return result;
			}
			if(StringUtils.isNotEmpty(isUpLoadLoa) && !"2".equals(isUpLoadLoa)){
				vo.setIsUploadLoa(Integer.valueOf(isUpLoadLoa));
			}
			if(StringUtils.isNotEmpty(isRecycleLoa) && !"2".equals(isRecycleLoa)){
				vo.setIsRecycleLoa(Integer.valueOf(isRecycleLoa));
			}
		}
		try{
			// 根据ID查询供应商信息
			vo.setId(Long.valueOf(splId));
			vo.setMdfTm(new Date());
			vo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			boolean b = this.prdSplInfoService.modifyLoa(vo);
			if(!b){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("修改失败！");
			}
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败");
			BaseLogUtils.newWebLogger("修改对象失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败");
			BaseLogUtils.newWebLogger("修改对象失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result ;
	}
}
